summaryrefslogtreecommitdiffstats
path: root/usr.bin/strings
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-03-29 13:18:16 +0000
committerphk <phk@FreeBSD.org>1999-03-29 13:18:16 +0000
commit6032d94240b9124fbae071aa670934c7e3ead6ac (patch)
tree9b96f2e7f6a9f1c465645533dd55ca8e8044ef55 /usr.bin/strings
parent917c0ee7692e0867daf118a4dde31e60fd3c847e (diff)
downloadFreeBSD-src-6032d94240b9124fbae071aa670934c7e3ead6ac.zip
FreeBSD-src-6032d94240b9124fbae071aa670934c7e3ead6ac.tar.gz
malloc(3) need to allocate one byte more.
PR: 10855 Submitted by: Petteri Holländer <pete@iki.fi>
Diffstat (limited to 'usr.bin/strings')
-rw-r--r--usr.bin/strings/strings.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/strings/strings.c b/usr.bin/strings/strings.c
index 663d73d..8001167 100644
--- a/usr.bin/strings/strings.c
+++ b/usr.bin/strings/strings.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)strings.c 8.2 (Berkeley) 1/28/94";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: strings.c,v 1.6 1997/08/11 07:31:28 charnier Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -137,7 +137,7 @@ main(argc, argv)
else if (minlen < 1)
errx(1, "length less than 1");
- if (!(bfr = malloc((u_int)minlen)))
+ if (!(bfr = malloc((u_int)minlen + 1)))
errx(1, "malloc");
bfr[minlen] = '\0';
file = "stdin";
OpenPOWER on IntegriCloud