From 6419d6f7beb6af32facab158fcfb4f2dc973ccf0 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Tue, 12 Dec 2006 16:43:03 +0000 Subject: Fix crash on systems that do not provide strdup() in out-of-memory conditions. Patch by Andreas Krennmair. svn path=/branches/BRANCH_6-3/; revision=4988 --- NEWS | 2 ++ TODO.txt | 3 +++ xmalloc.c | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 142b0f22..40e13eb5 100644 --- a/NEWS +++ b/NEWS @@ -85,6 +85,8 @@ fetchmail 6.3.6 (not yet released): This is important when fetchmail is in daemon mode and /etc/resolv.conf is changed later by dhcpcd, dhclient, pppd, openvpn or other ip-up/ipchange scripts. Should fix Debian Bug#389270, Bug#391698. +* Fix crash on systems that do not provide strdup() in out-of-memory conditions. + Patch by Andreas Krennmair. # TRANSLATIONS: * New en_GB (British English) translation by David Lodge. diff --git a/TODO.txt b/TODO.txt index 34ef153a..f390d5d0 100644 --- a/TODO.txt +++ b/TODO.txt @@ -10,6 +10,9 @@ Ian D. Allen, fetchmail-users. Two messages with examples. What goes here? fetchmailrc location, server, port, user, folder, anything else? +6.4: +- remove dead replacement functions: strdup (Andreas Krennmair), ... + CODE: - check recent list mail - check Debian BTS and other bug trackers diff --git a/xmalloc.c b/xmalloc.c index c5af357c..a762d0a2 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -63,7 +63,8 @@ char *strdup(const char *s) { char *p; p = (char *) malloc(strlen(s)+1); - strcpy(p,s); + if (p) + strcpy(p,s); return p; } #endif /* !HAVE_STRDUP */ -- cgit v1.2.3