summaryrefslogtreecommitdiff
path: root/bin/ed
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>1999-12-04 23:45:37 +0000
committerNiels Provos <provos@cvs.openbsd.org>1999-12-04 23:45:37 +0000
commit5be41960b58b7817c2f421bdd6f5a3985ec94e4f (patch)
tree81d8c0471f08998d32a61167ffd5fb99c505ea2a /bin/ed
parentb925b0db667a4180fe63e3f59c05fe2468c5285b (diff)
remove oflow in strip_escapes...
Diffstat (limited to 'bin/ed')
-rw-r--r--bin/ed/main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/ed/main.c b/bin/ed/main.c
index 150e0ba74a9..0be9a35f5b9 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.14 1998/05/18 20:36:14 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.15 1999/12/04 23:45:36 provos Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
@@ -39,7 +39,7 @@ char *copyright =
#if 0
static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.14 1998/05/18 20:36:14 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.15 1999/12/04 23:45:36 provos Exp $";
#endif
#endif /* not lint */
@@ -1376,8 +1376,10 @@ strip_escapes(s)
REALLOC(file, filesz, MAXPATHLEN + 1, NULL);
/* assert: no trailing escape */
- while ((file[i++] = (*s == '\\') ? *++s : *s) != '\0')
+ while ((file[i++] = (*s == '\\') ? *++s : *s) != '\0' &&
+ i < MAXPATHLEN)
s++;
+ file[MAXPATHLEN] = '\0';
return file;
}