Blame SOURCES/arptables-0.0.4-covscan_fix01_simple.patch

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