summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2007-08-10 12:28:46 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2007-08-10 12:28:46 (GMT)
commit819caa6eacef6cc3782c9b07d15bb6354de02818 (patch) (side-by-side diff)
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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/dnsbase.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/dnsbase.c b/src/dnsbase.c
index 7290fc4..777ca7e 100644
--- a/src/dnsbase.c
+++ b/src/dnsbase.c
@@ -606,11 +606,13 @@ a_lookup(const char *host,
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;
@@ -623,7 +625,6 @@ a_lookup(const char *host,
ld.loopcnt = MAXCNAMEDEPTH;
cnameloop(&ld);
- free(ld.name);
if (ld.status == dns_success) {
if (ipcount)
*ipcount = ld.hbcount;

Return to:

Send suggestions and report system problems to the System administrator.