svn: 3791
@@ -4,6 +4,7 @@
* Fix leaf bots not updating behind other hubs (fixes #419)
* Removed BDHASH as it wasn't even used.
* SHELLHASH now supports SHA1 hashes.
+* Fix segfault from receiving truncated DNS replies.
1.2.15 - http://wraith.botpack.net/milestone/1.2.15
* Fix a possible segfault when binaries compiled wrong
@@ -896,6 +896,11 @@ static int parse_reply(char *response, size_t nbytes)
}
ptr += reply.rdlength;
+ if ((size_t) (ptr - (unsigned char*) response) > nbytes) {
+ sdprintf("MALFORMED/TRUNCATED DNS PACKET detected (need TCP).");
+ q->remaining = 0;
+ break;
+ }
/* Don't continue if we haven't gotten all expected replies. */
if (--q->remaining > 0) return 0;