aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2015-12-01 12:24:38 +0000
committerJustus Winter <[email protected]>2015-12-01 12:24:38 +0000
commit9c34711539fc2c34aea8da0fd49ae6aa28991518 (patch)
tree4de7f7aa89e616809a18b115085a130dd9e4cccc
parentUpdate NEWS file (diff)
downloadgnupg-9c34711539fc2c34aea8da0fd49ae6aa28991518.tar.gz
gnupg-9c34711539fc2c34aea8da0fd49ae6aa28991518.zip
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 <[email protected]>
Diffstat (limited to '')
-rw-r--r--dirmngr/dns-stuff.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
index b3ad9bcd1..1bf6cfcd9 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)];