summaryrefslogtreecommitdiff
blob: 09875054fab77e6080a7fc282929d3019f4604e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
=== modified file 'src/common/cidr.c'
--- src/common/cidr.c	2010-10-29 13:00:54 +0000
+++ src/common/cidr.c	2010-10-29 13:09:01 +0000
@@ -85,11 +85,12 @@
 destroy_cidr(tcpr_cidr_t * cidr)
 {
 
-    if (cidr != NULL)
+    if (cidr != NULL) {
         if (cidr->next != NULL)
             destroy_cidr(cidr->next);
 
-    safe_free(cidr);
+        safe_free(cidr);
+    }
     return;
 
 }
@@ -667,7 +668,7 @@
 cidr2iplist(tcpr_cidr_t * cidr, char delim)
 {
     char *list = NULL;
-    char ipaddr[16];
+    char ipaddr[16], tempbuff[20];
     u_int32_t size, addr, first, last, numips;
     struct in_addr in;
 
@@ -694,7 +695,8 @@
     /* loop through all but the last one */
     for (addr = first; addr < last; addr++) {
         in.s_addr = htonl(addr);
-        snprintf(ipaddr, 17, "%s%c", inet_ntoa(in), delim);
+        snprintf(tempbuff, 17, "%s%c", inet_ntoa(in), delim);
+        memcpy(ipaddr, tempbuff, 16);
         dbgx(2, "%s", ipaddr);
         strlcat(list, ipaddr, size);
     }