~samiam/MaraDNS

ref: 3.5.0021 MaraDNS/deadwood-github/update/3.1.02/deadwood-3.1.01-crash_hotfix.patch -rw-r--r-- 2.2 KiB
ca00f282 — Sam Trenholme MaraDNS release 3.5.0021 9 months ago
                                                                                
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
43
44
45
46
47
48
--- deadwood-3.1.01/src/DwUdpSocket.c	2011-11-27 15:35:18.000000000 -0600
+++ deadwood-3.1.02/src/DwUdpSocket.c	2011-11-27 20:22:01.299849551 -0600
@@ -395,13 +395,15 @@
         }
 
         rem[b].local[rem[b].num_locals - 1] = malloc(sizeof(local_T));
+	if(rem[b].local[rem[b].num_locals - 1] != 0) {
+		rem[b].local[rem[b].num_locals - 1]->orig_query = 0;
+        	rem[b].local[rem[b].num_locals - 1]->action = 0;
+	}
         if(rem[b].socket == INVALID_SOCKET ||
            rem[b].local[rem[b].num_locals - 1] == 0) {
                 reset_rem(b);
                 return -1;
         }
-        rem[b].local[rem[b].num_locals - 1]->orig_query = 0;
-        rem[b].local[rem[b].num_locals - 1]->action = 0;
         rem[b].local[rem[b].num_locals - 1]->from_socket = sock;
         rem[b].local[rem[b].num_locals - 1]->tcp_num = tcp_num;
         if(from_ip != 0) {
--- deadwood-3.1.01/src/DwRecurse.c	2011-11-27 15:35:19.000000000 -0600
+++ deadwood-3.1.02/src/DwRecurse.c	2011-11-27 20:24:29.737226071 -0600
@@ -2741,8 +2741,11 @@
                 return -2; /* No more inflights for this query; make new one */
         }
         rem[already].num_locals++;
-        rem[already].local[rem[already].num_locals - 1] =
-                        malloc(sizeof(local_T));
+        rem[already].local[rem[already].num_locals-1]=malloc(sizeof(local_T));
+	if(rem[already].local[rem[already].num_locals-1] != 0) {
+		rem[already].local[rem[already].num_locals-1]->orig_query = 0;
+		rem[already].local[rem[already].num_locals-1]->action = 0;
+	}
         dwx_init_conn_local(already,rem[already].num_locals - 1);
         if(rem[already].socket == INVALID_SOCKET ||
            rem[already].local[rem[already].num_locals - 1] == 0) {
@@ -2816,7 +2819,10 @@
         rem[new_conn_num].die = get_time() + ((int64_t)timeout_seconds << 8);
         rem[new_conn_num].num_locals = 1;
         rem[new_conn_num].local[0] = malloc(sizeof(local_T));
-        rem[new_conn_num].local[0]->orig_query = 0;
+	if(rem[new_conn_num].local[0] != 0) {
+        	rem[new_conn_num].local[0]->orig_query = 0;
+        	rem[new_conn_num].local[0]->action = 0;
+	}
         dwx_init_conn_local(new_conn_num,0);
         if(rem[new_conn_num].socket == INVALID_SOCKET ||
            rem[new_conn_num].local[0] == 0) {