Blame SOURCES/arptables-0.0.4-covscan_fix01_simple.patch

29ecbd
commit 461c0674967504fafe7feb7631c51e7fceb67753
29ecbd
Author: Jaromír Končický <jkoncick@redhat.com>
29ecbd
Date:   Tue Oct 15 21:40:20 2013 +0200
29ecbd
29ecbd
    make static analysis tool happy (false positive)
29ecbd
29ecbd
diff --git a/userspace/arptables/arptables.c b/userspace/arptables/arptables.c
29ecbd
index 5535ab2..8ef445a 100644
29ecbd
--- a/userspace/arptables/arptables.c
29ecbd
+++ b/userspace/arptables/arptables.c
29ecbd
@@ -1668,10 +1668,12 @@ static char *get_modprobe(void)
29ecbd
 
29ecbd
 	ret = malloc(1024);
29ecbd
 	if (ret) {
29ecbd
-		switch (read(procfile, ret, 1024)) {
29ecbd
+		int read_bytes = read(procfile, ret, 1024);
29ecbd
+		switch (read_bytes) {
29ecbd
 		case -1: goto fail;
29ecbd
 		case 1024: goto fail; /* Partial read.  Wierd */
29ecbd
 		}
29ecbd
+		ret[read_bytes] = '\0';
29ecbd
 		if (ret[strlen(ret)-1]=='\n')
29ecbd
 			ret[strlen(ret)-1]=0;
29ecbd
 		close(procfile);