Blame SOURCES/0002-make-static-analysis-tool-happy-false-positive.patch

0890d3
From 370a0929ce2e08f508df76392de5617c614103ea Mon Sep 17 00:00:00 2001
0890d3
From: =?UTF-8?q?Jarom=C3=ADr=20Kon=C4=8Dick=C3=BD?= <jkoncick@redhat.com>
0890d3
Date: Tue, 15 Oct 2013 21:40:20 +0200
0890d3
Subject: [PATCH] make static analysis tool happy (false positive)
0890d3
0890d3
(cherry picked from commit ee4ec133bc5616f3d2b9efd468dfc1d42ca1c17d)
0890d3
Signed-off-by: Phil Sutter <psutter@redhat.com>
0890d3
---
0890d3
 arptables.c | 4 +++-
0890d3
 1 file changed, 3 insertions(+), 1 deletion(-)
0890d3
0890d3
diff --git a/arptables.c b/arptables.c
0890d3
index 5535ab23780d5..8ef445a4700c4 100644
0890d3
--- a/arptables.c
0890d3
+++ b/arptables.c
0890d3
@@ -1668,10 +1668,12 @@ static char *get_modprobe(void)
0890d3
 
0890d3
 	ret = malloc(1024);
0890d3
 	if (ret) {
0890d3
-		switch (read(procfile, ret, 1024)) {
0890d3
+		int read_bytes = read(procfile, ret, 1024);
0890d3
+		switch (read_bytes) {
0890d3
 		case -1: goto fail;
0890d3
 		case 1024: goto fail; /* Partial read.  Wierd */
0890d3
 		}
0890d3
+		ret[read_bytes] = '\0';
0890d3
 		if (ret[strlen(ret)-1]=='\n')
0890d3
 			ret[strlen(ret)-1]=0;
0890d3
 		close(procfile);
0890d3
-- 
0890d3
2.21.0
0890d3