arrfab / rpms / shim

Forked from rpms/shim 4 years ago
Clone

Blame SOURCES/0013-Lengths-that-might-be-1-can-t-be-unsigned-Peter.patch

4210fa
From 27129a5a05d1947e6f7479766e8281d50d6031f6 Mon Sep 17 00:00:00 2001
4210fa
From: Peter Jones <pjones@redhat.com>
4210fa
Date: Thu, 21 Nov 2013 11:26:08 -0500
4210fa
Subject: [PATCH 13/74] Lengths that might be -1 can't be unsigned, Peter.
4210fa
4210fa
Signed-off-by: Peter Jones <pjones@redhat.com>
4210fa
---
4210fa
 netboot.c | 8 +++++---
4210fa
 1 file changed, 5 insertions(+), 3 deletions(-)
4210fa
4210fa
diff --git a/netboot.c b/netboot.c
4210fa
index 1732dc7..07e2773 100644
4210fa
--- a/netboot.c
4210fa
+++ b/netboot.c
4210fa
@@ -307,10 +307,10 @@ static EFI_STATUS parseDhcp6()
4210fa
 static EFI_STATUS parseDhcp4()
4210fa
 {
4210fa
 	CHAR8 *template = (CHAR8 *)translate_slashes(DEFAULT_LOADER_CHAR);
4210fa
-	UINTN template_len = strlen(template) + 1;
4210fa
+	INTN template_len = strlen(template) + 1;
4210fa
 
4210fa
-	UINTN dir_len = strnlena(pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile, 127);
4210fa
-	UINTN i;
4210fa
+	INTN dir_len = strnlena(pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile, 127);
4210fa
+	INTN i;
4210fa
 	UINT8 *dir = pxe->Mode->DhcpAck.Dhcpv4.BootpBootFile;
4210fa
 
4210fa
 	for (i = dir_len; i >= 0; i--) {
4210fa
@@ -329,6 +329,8 @@ static EFI_STATUS parseDhcp4()
4210fa
 		if (full_path[dir_len-1] == '/' && template[0] == '/')
4210fa
 			full_path[dir_len-1] = '\0';
4210fa
 	}
4210fa
+	if (dir_len == 0 && dir[0] != '/' && template[0] == '/')
4210fa
+		template++;
4210fa
 	strcata(full_path, template);
4210fa
 	memcpy(&tftp_addr.v4, pxe->Mode->DhcpAck.Dhcpv4.BootpSiAddr, 4);
4210fa
 
4210fa
-- 
4210fa
1.9.3
4210fa