From 4327ec61e7cf831d0e411157396bca0d3b400f60 Mon Sep 17 00:00:00 2001 From: eivind Date: Sun, 9 Feb 1997 14:09:47 +0000 Subject: Buffer overflow patch. --- sbin/restore/symtab.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sbin/restore') 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) -- cgit v1.1