summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfram Schneider <wosch@FreeBSD.org>2003-11-12 14:26:19 +0000
committerWolfram Schneider <wosch@FreeBSD.org>2003-11-12 14:26:19 +0000
commit99703777c9b62e32e554dda29b81ae1e4a7a4a21 (patch)
treeddd282ab9f4ff5145aa81b5b048d01b7e11b55e2
parentFix a number of style issues, most of which were pointed out by portlint (diff)
Long patterns force a core dump:
$ ./agrep `perl -e 'print "y" x 240'` /dev/null Segmentation fault (core dumped)
Notes
Notes: svn path=/head/; revision=93819
-rw-r--r--textproc/agrep/files/patch-strncpy11
1 files changed, 11 insertions, 0 deletions
diff --git a/textproc/agrep/files/patch-strncpy b/textproc/agrep/files/patch-strncpy
new file mode 100644
index 000000000000..258f9af23f62
--- /dev/null
+++ b/textproc/agrep/files/patch-strncpy
@@ -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++;
+ }