diff options
author | eivind <eivind@FreeBSD.org> | 1997-02-09 14:09:47 +0000 |
---|---|---|
committer | eivind <eivind@FreeBSD.org> | 1997-02-09 14:09:47 +0000 |
commit | 4327ec61e7cf831d0e411157396bca0d3b400f60 (patch) | |
tree | 5af1aa85832697746f85c494c5cd2c59199e8005 /sbin/restore | |
parent | 89fe9f1d6f1d56206713195c5b0d67f487845672 (diff) | |
download | FreeBSD-src-4327ec61e7cf831d0e411157396bca0d3b400f60.zip FreeBSD-src-4327ec61e7cf831d0e411157396bca0d3b400f60.tar.gz |
Buffer overflow patch.
Diffstat (limited to 'sbin/restore')
-rw-r--r-- | sbin/restore/symtab.c | 5 |
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) |