Make sure that buffer is NULL terminated when input to strip_escapes() is

too long.  (Thanks jnemeth!)
This commit is contained in:
ginsbach 2009-06-10 04:16:53 +00:00
parent 23b4863243
commit 389bb545f4

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.21 2009/06/10 03:24:27 ginsbach Exp $ */
/* $NetBSD: main.c,v 1.22 2009/06/10 04:16:53 ginsbach Exp $ */
/* main.c: This file contains the main control and user-interface routines
for the ed line editor. */
@ -39,7 +39,7 @@ __COPYRIGHT(
#if 0
static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
#else
__RCSID("$NetBSD: main.c,v 1.21 2009/06/10 03:24:27 ginsbach Exp $");
__RCSID("$NetBSD: main.c,v 1.22 2009/06/10 04:16:53 ginsbach Exp $");
#endif
#endif /* not lint */
@ -1329,6 +1329,7 @@ strip_escapes(const char *s)
while ((i < (filesz - 1)) &&
(file[i++] = (*s == '\\') != '\0' ? *++s : *s))
s++;
file[filesz - 1] = '\0';
return file;
}