summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1997-02-09 18:55:16 +0000
committerderaadt <deraadt@openbsd.org>1997-02-09 18:55:16 +0000
commitc34257a45e6c24a3893bfc1d4d992d37f8f2df14 (patch)
treebadb7b307216be251acae5acc860fe3e94843d1e
parentdo not make changes here that hide a problem which needs fixing (diff)
downloadwireguard-openbsd-c34257a45e6c24a3893bfc1d4d992d37f8f2df14.tar.xz
wireguard-openbsd-c34257a45e6c24a3893bfc1d4d992d37f8f2df14.zip
unexploitable buf oflow, eivind@freebsd
-rw-r--r--sbin/restore/symtab.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c
index 21b6437402b..d877e12cba7 100644
--- a/sbin/restore/symtab.c
+++ b/sbin/restore/symtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: symtab.c,v 1.3 1996/12/04 01:41:53 deraadt Exp $ */
+/* $OpenBSD: symtab.c,v 1.4 1997/02/09 18:55:16 deraadt Exp $ */
/* $NetBSD: symtab.c,v 1.9 1996/11/30 18:04:47 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)symtab.c 8.2 (Berkeley) 9/13/94";
#else
-static char rcsid[] = "$OpenBSD: symtab.c,v 1.3 1996/12/04 01:41:53 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: symtab.c,v 1.4 1997/02/09 18:55:16 deraadt Exp $";
#endif
#endif /* not lint */
@@ -157,8 +157,11 @@ lookupname(name)
cp = name;
for (ep = lookupino(ROOTINO); ep != NULL; ep = ep->e_entries) {
- for (np = buf; *cp != '/' && *cp != '\0'; )
+ for (np = buf;
+ *cp != '/' && *cp != '\0' && np < &buf[sizeof(buf)]; )
*np++ = *cp++;
+ if (np == &buf[sizeof(buf)])
+ break;
*np = '\0';
for ( ; ep != NULL; ep = ep->e_sibling)
if (strcmp(ep->e_name, buf) == 0)