aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-03-21 22:08:35 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-03-21 22:08:35 +0000
commit709883cf99eee0c5a7643b677731decc88b3fce8 (patch)
tree9a55151240d6f37f1b9e883d252eb882d40e470a
parent7804fb63eb0b6fb6c4f9108cfafbf1af74e20e7b (diff)
downloadfetchmail-709883cf99eee0c5a7643b677731decc88b3fce8.tar.gz
fetchmail-709883cf99eee0c5a7643b677731decc88b3fce8.tar.bz2
fetchmail-709883cf99eee0c5a7643b677731decc88b3fce8.zip
Work around C libraries that return a NULL in getaddrinfo()'s ai_canonname
record, to avoid a segfault. Affects, for instance, FreeBSD 4.11. Reported and patched by "Voldemar" via fetchmail-users@. svn path=/branches/BRANCH_6-3/; revision=4750
-rw-r--r--NEWS7
-rw-r--r--driver.c10
2 files changed, 14 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index e8869919..0ee69dba 100644
--- a/NEWS
+++ b/NEWS
@@ -29,11 +29,14 @@ change. MA = Matthias Andree, ESR = Eric S. Raymond, RF = Rob Funk.)
fetchmail 6.3.3 (not yet released):
# BUG FIXES:
-* Do not attempt to overwrite the netrc password if none has been specified.
- This fixes a segmentation fault bug introduced into 6.3.2.
+* SEGFAULT: Do not attempt to overwrite the netrc password if none has been
+ specified. This fixes a segmentation fault bug introduced into 6.3.2.
Fixes BerliOS bug #6234. BerliOS patch #804 by Craig Leres.
The patch, as accepted into fetchmail, was available separately from
<http://download.berlios.de/fetchmail/patch-6.3.2.1-fix-netrc-SIGSEGV.diff>
+* SEGFAULT: Work around C libraries that return a NULL in getaddrinfo()'s
+ ai_canonname record, to avoid a segfault. Affects, for instance, FreeBSD 4.11.
+ Reported and patched by "Voldemar".
* Handle other clients concurrently accessing IMAP mailboxes better.
Fetchmail quits the poll if the EXPUNGE count does not match expectations, and
servers not updating RECENT counts after EXPUNGE are handled in a better way.
diff --git a/driver.c b/driver.c
index 1d39f068..f58779f5 100644
--- a/driver.c
+++ b/driver.c
@@ -1028,7 +1028,15 @@ static int do_session(
else
{
xfree(ctl->server.truename);
- ctl->server.truename = xstrdup(res->ai_canonname);
+ /* Older FreeBSD versions return NULL in ai_canonname
+ * if they cannot canonicalize, rather than copying
+ * the queryname here, as IEEE Std 1003.1-2001
+ * requires. Work around NULL. */
+ if (res->ai_canonname != NULL) {
+ ctl->server.truename = xstrdup(res->ai_canonname);
+ } else {
+ ctl->server.truename = xstrdup(ctl->server.queryname);
+ }
ctl->server.trueaddr = (struct sockaddr *)xmalloc(res->ai_addrlen);
ctl->server.trueaddr_len = res->ai_addrlen;
memcpy(ctl->server.trueaddr, res->ai_addr, res->ai_addrlen);