1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-22 20:41:26 +00:00

Long patterns force a core dump:

$ ./agrep  `perl -e 'print "y" x 240'`  /dev/null
Segmentation fault (core dumped)
This commit is contained in:
Wolfram Schneider 2003-11-12 14:26:19 +00:00
parent 36c0b75c33
commit 99703777c9
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=93819

View File

@ -0,0 +1,11 @@
--- 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++;
}