aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-08-10 12:28:46 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-08-10 12:28:46 +0000
commit819caa6eacef6cc3782c9b07d15bb6354de02818 (patch)
treec5a029b9e3d2d1e6fe94d5ede665a807d44434aa
parent6b0ce20d6bec52b759ac4ff479ce055a635046a9 (diff)
downloadmailfromd-819caa6eacef6cc3782c9b07d15bb6354de02818.tar.gz
mailfromd-819caa6eacef6cc3782c9b07d15bb6354de02818.tar.bz2
(a_lookup): Make name buffer big enough to hold eventual CNAME expansions.
git-svn-id: file:///svnroot/mailfromd/trunk@1501 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r--src/dnsbase.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/dnsbase.c b/src/dnsbase.c
index 7290fc46..777ca7ee 100644
--- a/src/dnsbase.c
+++ b/src/dnsbase.c
@@ -603,30 +603,31 @@ dns_resolve_hostname(const char *host, char *answer, size_t answer_size,
dns_status
a_lookup(const char *host,
GACOPYZ_UINT32_T *ipbuf, size_t ipbsize, size_t *ipcount,
unsigned long *ttl, char *answer, size_t answer_size)
{
struct loop_data ld;
- char domainbuf[256] = "";
+ char namebuf[NSIZE];
+ char domainbuf[NSIZE] = "";
ld.qtype = ld.atype = T_A;
- ld.name = xstrdup(host);
- ld.name_size = strlen(ld.name);
+ strncpy(namebuf, host, sizeof namebuf - 1);
+ ld.name = namebuf;
+ ld.name_size = sizeof namebuf;
ld.domain = domainbuf;
ld.domain_size = sizeof domainbuf;
ld.answer = answer;
ld.answer_size = answer_size;
ld.hbuf = (char*) ipbuf;
ld.hbsize = ipbsize * sizeof ipbuf[0];
ld.hbcount = 0;
ld.ttl = ~(unsigned long)0;
ld.status = dns_failure;
ld.loopcnt = MAXCNAMEDEPTH;
cnameloop(&ld);
- free(ld.name);
if (ld.status == dns_success) {
if (ipcount)
*ipcount = ld.hbcount;
if (ttl)
*ttl = ld.ttl;
}

Return to:

Send suggestions and report system problems to the System administrator.