mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-26 16:18:31 +00:00
malloc(3) need to allocate one byte more.
PR: 10855 Submitted by: Petteri Holländer <pete@iki.fi>
This commit is contained in:
parent
350fcdb834
commit
31f9b07613
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45113
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user