Blame SOURCES/open-iscsi-2.0.875-19-Skip-useless-strcopy-and-validate-CIDR-length.patch

47585c
From a7a96131bd2ea342f6def0e46be514baf8037ae8 Mon Sep 17 00:00:00 2001
47585c
From: Lee Duncan <lduncan@suse.com>
47585c
Date: Fri, 15 Dec 2017 11:18:35 -0800
47585c
Subject: [PATCH] Skip useless strcopy, and validate CIDR length
47585c
47585c
Remove a useless strcpy() that copies a string onto itself,
47585c
and ensure the CIDR length "keepbits" is not negative.
47585c
Found by Qualsys.
47585c
---
47585c
 iscsiuio/src/unix/iscsid_ipc.c | 5 ++---
47585c
 1 file changed, 2 insertions(+), 3 deletions(-)
47585c
47585c
diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
47585c
index 8478f9a411a3..4e3d065667c9 100644
47585c
--- a/iscsiuio/src/unix/iscsid_ipc.c
47585c
+++ b/iscsiuio/src/unix/iscsid_ipc.c
47585c
@@ -143,7 +143,7 @@ static int decode_cidr(char *in_ipaddr_str, struct iface_rec_decode *ird)
47585c
 	char *tmp, *tok;
47585c
 	char ipaddr_str[NI_MAXHOST];
47585c
 	char str[INET6_ADDRSTRLEN];
47585c
-	int keepbits = 0;
47585c
+	unsigned long keepbits = 0;
47585c
 	struct in_addr ia;
47585c
 	struct in6_addr ia6;
47585c
 
47585c
@@ -156,8 +156,7 @@ static int decode_cidr(char *in_ipaddr_str, struct iface_rec_decode *ird)
47585c
 		tmp = ipaddr_str;
47585c
 		tok = strsep(&tmp, "/");
47585c
 		LOG_INFO(PFX "in cidr: bitmask '%s' ip '%s'", tmp, tok);
47585c
-		keepbits = atoi(tmp);
47585c
-		strcpy(ipaddr_str, tok);
47585c
+		keepbits = strtoull(tmp, NULL, 10);
47585c
 	}
47585c
 
47585c
 	/*  Determine if the IP address passed from the iface file is
47585c
-- 
47585c
2.17.2
47585c