From f6a2380b73de5b9c5fe306f362c8f5597749c552 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Mon, 30 Jan 2006 09:00:03 +0000 Subject: Craig Leres: only overwrite password if the pointer is non-NULL. Avoids a crash in .netrc files with missing passwords. svn path=/branches/BRANCH_6-3/; revision=4684 --- netrc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'netrc.c') diff --git a/netrc.c b/netrc.c index 6c68d2c0..ea422edf 100644 --- a/netrc.c +++ b/netrc.c @@ -314,8 +314,10 @@ void free_netrc(netrc_entry *a) { while(a) { netrc_entry *n = a->next; - memset(a->password, 0x55, strlen(a->password)); - xfree(a->password); + if (a->password != NULL) { + memset(a->password, 0x55, strlen(a->password)); + free(a->password); + } xfree(a->login); xfree(a->host); xfree(a); -- cgit v1.2.3