Browse code

core: safety checks for pointer in dbg message printed inside dns cache

Daniel-Constantin Mierla authored on 21/04/2014 15:52:07
Showing 1 changed files
... ...
@@ -2369,9 +2369,9 @@ found:
2369 2369
 	DBG("dns_srv_get_nxt_rr(%p, %lx, %d, %u): selected %d/%d in grp. %d"
2370 2370
 			" (rand_w=%d, rr=%p rd=%p p=%d w=%d rsum=%d)\n",
2371 2371
 		e, (unsigned long)*tried, *no, now, i, idx, n, rand_w, r_sums[i].rr,
2372
-		r_sums[i].rr->rdata,
2373
-		(r_sums[i].rr->rdata)?((struct srv_rdata*)r_sums[i].rr->rdata)->priority:0,
2374
-		(r_sums[i].rr->rdata)?((struct srv_rdata*)r_sums[i].rr->rdata)->weight:0,
2372
+		(r_sums[i].rr)?r_sums[i].rr->rdata:0,
2373
+		(r_sums[i].rr&&r_sums[i].rr->rdata)?((struct srv_rdata*)r_sums[i].rr->rdata)->priority:0,
2374
+		(r_sums[i].rr&&r_sums[i].rr->rdata)?((struct srv_rdata*)r_sums[i].rr->rdata)->weight:0,
2375 2375
 		r_sums[i].r_sum);
2376 2376
 #endif
2377 2377
 	/* i is the winner */