summaryrefslogtreecommitdiff
blob: 142aa5941f8cc18bd3838bdaef0892caef59ccc8 (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
39
40
41
42
This patch fixes memory errors

Author: David Sugar

--- commoncpp/address.cpp
+++ commoncpp/address.cpp
@@ -360,7 +360,7 @@
             if(ipaddr)
                 delete[] ipaddr;
             ipaddr = new struct in_addr[1];
-            memset((void *)&ipaddr[0], 0, sizeof(ipaddr));
+            memset((void *)&ipaddr[0], 0, sizeof(struct in_addr));
             return;
         }
 
@@ -498,7 +498,7 @@
     : validator(_validator), hostname(NULL) {
     addr_count = 1;
     ipaddr = new struct in6_addr[1];
-    memcpy(ipaddr, &in6addr_any, sizeof(in6_addr));
+    memcpy(ipaddr, &in6addr_any, sizeof(struct in6_addr));
 }
 
 IPV6Address::IPV6Address(const char *address, const IPV6Validator *_validator) :
@@ -716,7 +716,7 @@
             if(ipaddr)
                 delete[] ipaddr;
             ipaddr = new struct in6_addr[1];
-            memset((void *)&ipaddr[0], 0, sizeof(ipaddr));
+            memset((void *)&ipaddr[0], 0, sizeof(struct in6_addr));
             return;
         }
 
@@ -796,7 +796,7 @@
             if(ipaddr)
                 delete[] ipaddr;
             ipaddr = new struct in6_addr[1];
-            memset((void *)&ipaddr[0], 0, sizeof(ipaddr));
+            memset((void *)&ipaddr[0], 0, sizeof(struct in6_addr));
             return;
         }