From 1c34d301c1f016c4510c202d478e91fc0688e70f Mon Sep 17 00:00:00 2001 From: iedowse Date: Mon, 16 Jun 2003 20:48:56 +0000 Subject: [PATCH] When looking for the ':' separator in the root path, don't go past the terminating '\0'. Since the initialisation of rootpath in libstand/bootp.c may copy junk into the rest of the buffer, it was possible for the code to find a ':' after the '\0' and do the wrong thing. Reviewed by: ps MFC after: 1 week --- sys/boot/i386/libi386/pxe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/boot/i386/libi386/pxe.c b/sys/boot/i386/libi386/pxe.c index 6e01a2834b68..68081df584b5 100644 --- a/sys/boot/i386/libi386/pxe.c +++ b/sys/boot/i386/libi386/pxe.c @@ -286,10 +286,10 @@ pxe_open(struct open_file *f, ...) if (!rootpath[1]) strcpy(rootpath, PXENFSROOTPATH); - for (i = 0; i < FNAME_SIZE; i++) + for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) if (rootpath[i] == ':') break; - if (i && i != FNAME_SIZE) { + if (i && i != FNAME_SIZE && rootpath[i] == ':') { rootpath[i++] = '\0'; if (inet_addr(&rootpath[0]) != INADDR_NONE) rootip.s_addr = inet_addr(&rootpath[0]);