From e03a4a94bb67d4a6c958b37671f83456e203f325 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 22 Oct 2015 09:52:51 +0200 Subject: dirmngr: Do not use MAXDNAME. * dirmngr/dns-stuff.c (getsrv): Replace MAXDNAME. * dirmngr/dns-stuff.h (MAXDNAME): Remove. (struct srventry): Use a fixed value instead of MAXDNAME. * dirmngr/http.c (connect_server): Use DIMof instead of MAXDNAME. Malloc a helper array. -- Depending on the order of included headers it might be that we allocate the array with a different size than what we test against in another module. To make it more robust we use the actual known size of checking. A better would be to use a linked list and avoid these large arrays. Signed-off-by: Werner Koch --- dirmngr/dns-stuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dirmngr/dns-stuff.c') diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c index c500c34e7..639388f55 100644 --- a/dirmngr/dns-stuff.c +++ b/dirmngr/dns-stuff.c @@ -651,7 +651,7 @@ getsrv (const char *name,struct srventry **list) struct srventry *srv = NULL; struct srventry *newlist; - if (strlen (answer->rrs.srvha[count].ha.host) >= MAXDNAME) + if (strlen (answer->rrs.srvha[count].ha.host) >= sizeof srv->target) { log_info ("hostname in SRV record too long - skipped\n"); continue; @@ -747,7 +747,7 @@ getsrv (const char *name,struct srventry **list) /* Get the name. 2782 doesn't allow name compression, but dn_expand still works to pull the name out of the packet. */ - rc = dn_expand(answer,emsg,pt,srv->target,MAXDNAME); + rc = dn_expand(answer,emsg,pt,srv->target, sizeof srv->target); if (rc == 1 && srv->target[0] == 0) /* "." */ { xfree(*list); -- cgit v1.2.3