diff options
-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) |