net-tools/net-tools-covscan.patch

93 lines
2.8 KiB
Diff
Raw Normal View History

diff --git a/ifconfig.c.old b/ifconfig.c
index 2b8cbbb..6505e07 100644
--- a/ifconfig.c.old
+++ b/ifconfig.c
@@ -967,8 +967,9 @@ int main(int argc, char **argv)
if (ap->herror)
ap->herror(host);
else
- fprintf(stderr,_("ifconfig: error resolving '%s' to set address for af=%s\n"), host, ap->name); fprintf(stderr,
- _("ifconfig: `--help' gives usage information.\n")); exit(1);
+ fprintf(stderr,_("ifconfig: error resolving '%s' to set address for af=%s\n"), host, ap->name);
+
+ fprintf(stderr,_("ifconfig: `--help' gives usage information.\n")); exit(1);
}
memcpy(&ifr.ifr_addr, sa, sizeof(struct sockaddr));
{
diff --git a/ipmaddr.c.old b/ipmaddr.c
index 2bfaf98..7a313c7 100644
--- a/ipmaddr.c.old
+++ b/ipmaddr.c
@@ -336,7 +336,7 @@ int multiaddr_modify(int cmd, int argc, char **argv)
NEXT_ARG();
if (ifr.ifr_name[0])
usage();
- strncpy(ifr.ifr_name, *argv, IFNAMSIZ);
+ strncpy(ifr.ifr_name, *argv, IFNAMSIZ-1);
} else {
if (ifr.ifr_hwaddr.sa_data[0])
usage();
diff --git a/lib/inet_gr.c.old b/lib/inet_gr.c
index b172d65..75ac240 100644
--- a/lib/inet_gr.c.old
+++ b/lib/inet_gr.c
@@ -292,6 +292,7 @@ int rprint_cache(int ext, int numeric)
printf(_("Source Destination Gateway "
"Flags Metric Ref Use Iface "
"MSS Window irtt TOS HHRef HHUptod SpecDst\n"));
+
fmt = proc_gen_fmt(_PATH_PROCNET_RTCACHE, 0, fp,
"Iface", "%15s",
"Destination", "%127s",
diff --git a/lib/ipx_gr.c.old b/lib/ipx_gr.c
index 2fa717c..b98c09c 100644
--- a/lib/ipx_gr.c.old
+++ b/lib/ipx_gr.c
@@ -57,6 +57,7 @@ int IPX_rprint(int options)
if ((ap = get_afntype(AF_IPX)) == NULL) {
EINTERN("lib/ipx_rt.c", "AF_IPX missing");
+ fclose(fp);
return (-1);
}
diff --git a/lib/netrom_gr.c.old b/lib/netrom_gr.c
index ec82fe8..7c3349f 100644
--- a/lib/netrom_gr.c.old
+++ b/lib/netrom_gr.c
@@ -43,8 +43,14 @@ int NETROM_rprint(int options)
if (!f2) perror(_PATH_PROCNET_NR_NEIGH);
if (f1 == NULL || f2 == NULL) {
- printf(_("NET/ROM not configured in this system.\n"));
- return 1;
+ printf(_("NET/ROM not configured in this system.\n"));
+ if(f1 != NULL)
+ fclose(f1);
+
+ if(f2 != NULL)
+ fclose(f2);
+
+ return 1;
}
printf(_("Kernel NET/ROM routing table\n"));
printf(_("Destination Mnemonic Quality Neighbour Iface\n"));
diff --git a/statistics.c.old b/statistics.c
index 02791ed..8c2e18e 100644
--- a/statistics.c.old
+++ b/statistics.c
@@ -568,10 +568,10 @@ int parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp)
f = proc_fopen("/proc/net/sctp/snmp");
if (f) {
process_fd2(f,"/proc/net/sctp/snmp");
- if (ferror(f)) {
+ if (ferror(f))
perror("/proc/net/sctp/snmp");
- fclose(f);
- }
+
+ fclose(f);
}
return(0);
}