From c7bc1f10cf2b1e7bfdd681578f674a1b53d2ca98 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 16 Dec 2007 18:55:47 +0000 Subject: [PATCH] r15520@tombo: nickm | 2007-12-16 13:54:22 -0500 Fix for bug 1846282: accept as well-formed DNS replies with questions but no answers. [Backport to 1.4] svn:r596 --- ChangeLog | 3 ++- evdns.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7beebab4..4b17fd89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,7 +17,8 @@ Changes in current version: o move EV_PERSIST handling out of the event backends o support for 32-bit tag numbers in rpc structures; this is wire compatible, but changes the API slightly. o prefix {encode,decode}_tag functions with evtag to avoid collisions - + o Correctly handle DNS replies with no answers set (Fixes bug 1846282) + Changes in 1.4.0-beta: o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr. diff --git a/evdns.c b/evdns.c index 06b9fcdc..40807372 100644 --- a/evdns.c +++ b/evdns.c @@ -867,7 +867,7 @@ reply_parse(u8 *packet, int length) { */ SKIP_NAME; j += 4; - if (j >= length) goto err; + if (j > length) goto err; } /* now we have the answer section which looks like