summaryrefslogtreecommitdiffstats
path: root/sbin/restore
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1997-02-09 14:09:47 +0000
committereivind <eivind@FreeBSD.org>1997-02-09 14:09:47 +0000
commit4327ec61e7cf831d0e411157396bca0d3b400f60 (patch)
tree5af1aa85832697746f85c494c5cd2c59199e8005 /sbin/restore
parent89fe9f1d6f1d56206713195c5b0d67f487845672 (diff)
downloadFreeBSD-src-4327ec61e7cf831d0e411157396bca0d3b400f60.zip
FreeBSD-src-4327ec61e7cf831d0e411157396bca0d3b400f60.tar.gz
Buffer overflow patch.
Diffstat (limited to 'sbin/restore')
-rw-r--r--sbin/restore/symtab.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c
index 9488a7f..dc779a3 100644
--- a/sbin/restore/symtab.c
+++ b/sbin/restore/symtab.c
@@ -150,8 +150,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)
OpenPOWER on IntegriCloud