Blame SOURCES/arptables-0.0.4-covscan_fix01_simple.patch

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