[Pkg-gnupg-commit] [gnupg2] 204/241: dirmngr: Improve error handling.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Dec 9 20:32:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 9c34711539fc2c34aea8da0fd49ae6aa28991518
Author: Justus Winter <justus at g10code.com>
Date:   Tue Dec 1 13:24:38 2015 +0100

    dirmngr: Improve error handling.
    
    * dirmngr/dns-stuff.c (getsrv): Avoid looking at 'header' before
    checking for errors, but silently ignore errors when looking up SRV
    records.
    --
    This is a follow-up to 946faaff.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 dirmngr/dns-stuff.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
index b3ad9bc..1bf6cfc 100644
--- a/dirmngr/dns-stuff.c
+++ b/dirmngr/dns-stuff.c
@@ -1086,10 +1086,9 @@ getsrv (const char *name,struct srventry **list)
       return -1;
 
     r = res_query (name, C_IN, T_SRV, answer, sizeof answer);
-    if (header->rcode != NOERROR || !(count=ntohs (header->ancount)))
+    if (r < sizeof (HEADER) || r > sizeof answer
+        || header->rcode != NOERROR || !(count=ntohs (header->ancount)))
       return 0; /* Error or no record found.  */
-    if (r < sizeof (HEADER) || r > sizeof answer)
-      return -1;
 
     emsg = &answer[r];
     pt = &answer[sizeof(HEADER)];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list