Blob Blame History Raw
From 27129a5a05d1947e6f7479766e8281d50d6031f6 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 21 Nov 2013 11:26:08 -0500
Subject: [PATCH 13/74] Lengths that might be -1 can't be unsigned, Peter.

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 netboot.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/netboot.c b/netboot.c
index 1732dc7..07e2773 100644
--- a/netboot.c
+++ b/netboot.c
@@ -307,10 +307,10 @@ static EFI_STATUS parseDhcp6()
 static EFI_STATUS parseDhcp4()
 {
 	CHAR8 *template = (CHAR8 *)translate_slashes(DEFAULT_LOADER_CHAR);
-	UINTN template_len = strlen(template) + 1;
+	INTN template_len = strlen(template) + 1;
 
-	UINTN dir_len = strnlena(pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile, 127);
-	UINTN i;
+	INTN dir_len = strnlena(pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile, 127);
+	INTN i;
 	UINT8 *dir = pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile;
 
 	for (i = dir_len; i >= 0; i--) {
@@ -329,6 +329,8 @@ static EFI_STATUS parseDhcp4()
 		if (full_path[dir_len-1] == '/' && template[0] == '/')
 			full_path[dir_len-1] = '\0';
 	}
+	if (dir_len == 0 && dir[0] != '/' && template[0] == '/')
+		template++;
 	strcata(full_path, template);
 	memcpy(&tftp_addr.v4, pxe->Mode->DhcpAck.Dhcpv4.BootpSiAddr, 4);
 
-- 
1.9.3