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

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