malloc(3) need to allocate one byte more.

PR:		10855
Submitted by:	Petteri Holländer <pete@iki.fi>
This commit is contained in:
Poul-Henning Kamp 1999-03-29 13:18:16 +00:00
parent 350fcdb834
commit 31f9b07613
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45113

View File

@ -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";