summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-libs/ldns/files/ldns-1.6.3-r3151-fix-double-free.patch')
-rw-r--r--net-libs/ldns/files/ldns-1.6.3-r3151-fix-double-free.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/net-libs/ldns/files/ldns-1.6.3-r3151-fix-double-free.patch b/net-libs/ldns/files/ldns-1.6.3-r3151-fix-double-free.patch
new file mode 100644
index 000000000000..8dd310d430e0
--- /dev/null
+++ b/net-libs/ldns/files/ldns-1.6.3-r3151-fix-double-free.patch
@@ -0,0 +1,52 @@
+Index: higher.c
+===================================================================
+--- higher.c (revision 3150)
++++ higher.c (revision 3151)
+@@ -198,7 +198,7 @@
+ break;
+ }
+ }
+- strncpy(addr, word, LDNS_IP6ADDRLEN);
++ strlcpy(addr, word, LDNS_MAX_LINELEN+1);
+ } else {
+ /* la al la la */
+ if (ip6) {
+Index: packet.c
+===================================================================
+--- packet.c (revision 3150)
++++ packet.c (revision 3151)
+@@ -456,17 +456,12 @@
+ {
+ uint16_t rid = 0;
+ #ifdef HAVE_SSL
+- unsigned char *rb;
+- rb = LDNS_XMALLOC(unsigned char, 2);
+- if (RAND_bytes(rb, 2) == 1) {
+- rid = ldns_read_uint16(rb);
+- }
+- LDNS_FREE(rb);
+-#endif
+- if (rid == 0) {
++ if (RAND_bytes((unsigned char*)&rid, 2) != 1) {
+ rid = (uint16_t) random();
+ }
+-
++#else
++ rid = (uint16_t) random();
++#endif
+ ldns_pkt_set_id(packet, rid);
+ }
+
+Index: net.c
+===================================================================
+--- net.c (revision 3150)
++++ net.c (revision 3151)
+@@ -652,6 +652,8 @@
+ if (!data) {
+ return NULL;
+ }
++ /* zero the structure for portability */
++ memset(data, 0, sizeof(struct sockaddr_storage));
+ if (port == 0) {
+ port = LDNS_PORT;
+ }