ports/textproc/agrep/files/patch-strncpy
Wolfram Schneider 99703777c9 Long patterns force a core dump:
$ ./agrep  `perl -e 'print "y" x 240'`  /dev/null
Segmentation fault (core dumped)
2003-11-12 14:26:19 +00:00

11 lines
310 B
Text

--- main.c 2003/11/12 14:09:11 1.1
+++ main.c 2003/11/12 14:09:31
@@ -751,7 +751,7 @@
}
if (!(PAT_FILE) && Pattern[0] == '\0') { /* Pattern not set with -e option */
if (argc == 0) usage();
- strcpy(Pattern, *argv);
+ strncpy(Pattern, *argv, sizeof(Pattern));
argc--;
argv++;
}