ref: 0ceeee4c8b207b3833e005643abf8997a60c255f
parent: 45333cdc92654eb58dc8c820dd58ae23c4a49640
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Aug 7 22:06:03 EDT 2014
ndb/dns: fix nil dereference crash with convM2DNS() returning reqmsg.qd == nil
--- a/sys/src/cmd/ndb/dnstcp.c
+++ b/sys/src/cmd/ndb/dnstcp.c
@@ -122,6 +122,12 @@
reqmsg.flags & Omask, caller);
break;
}
+
+ if(reqmsg.qd == nil){
+ dnslog("server: no question RR from %s", caller);
+ break;
+ }
+
if(debug)
dnslog("[%d] %d: serve (%s) %d %s %s",
getpid(), req.id, caller,
--- a/sys/src/cmd/ndb/dnudpserver.c
+++ b/sys/src/cmd/ndb/dnudpserver.c
@@ -215,6 +215,11 @@
goto freereq;
}
+ if(reqmsg.qd == nil){
+ dnslog("server: no question RR from %I", buf);
+ goto freereq;
+ }
+
if(debug || (trace && subsume(trace, reqmsg.qd->owner->name)))
dnslog("%d: serve (%I/%d) %d %s %s",
req.id, buf, uh->rport[0]<<8 | uh->rport[1],