conky/conky-1.6.1-ifaddrs.patch

24 lines
949 B
Diff
Raw Normal View History

diff -up conky-1.6.1/src/linux.c.ifaddrs conky-1.6.1/src/linux.c
--- conky-1.6.1/src/linux.c.ifaddrs 2008-08-20 12:50:15.000000000 +0200
+++ conky-1.6.1/src/linux.c 2008-08-20 12:50:31.000000000 +0200
@@ -353,7 +353,7 @@ void update_net_stats(void)
for (i2 = 0; i2 < 16; i2++) {
struct net_stat *ns;
char *s, *p;
- char temp_addr[17];
+ char temp_addr[18];
long long r, t, last_recv, last_trans;
if (fgets(buf, 255, net_dev_fp) == NULL) {
@@ -380,9 +380,9 @@ void update_net_stats(void)
memset(&(ns->addr.sa_data), 0, 14);
if(NULL == ns->addrs)
- ns->addrs = (char*) malloc(17 * 16);
+ ns->addrs = (char*) malloc(17 * 16 + 1);
if(NULL != ns->addrs)
- memset(ns->addrs, 0, 17 * 16); /* Up to 17 chars per ip, max 16 interfaces. Nasty memory usage... */
+ memset(ns->addrs, 0, 17 * 16 + 1); /* Up to 17 chars per ip, max 16 interfaces. Nasty memory usage... */
last_recv = ns->recv;
last_trans = ns->trans;