]> granicus.if.org Git - curl/commitdiff
Fixed a memory leak in the FTP code and an off-by-one heap buffer overflow.
authorDan Fandrich <dan@coneharvesters.com>
Tue, 11 Aug 2009 02:30:53 +0000 (02:30 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Tue, 11 Aug 2009 02:30:53 +0000 (02:30 +0000)
CHANGES
lib/ftp.c

diff --git a/CHANGES b/CHANGES
index e5fec2df0eb0888de1be2cd24235b86e6152a656..4ade707947df70853da9786c00afe83ecc4532c5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@
 
                                   Changelog
 
+Daniel Fandrich (10 Aug 2009)
+- Fixed a memory leak in the FTP code and an off-by-one heap buffer overflow.
+
 Daniel Fandrich (9 Aug 2009)
 - Fixed some memory leaks in the command-line tool that caused most of the
   torture tests to fail.
index 4ded990b690f06cc855f54b925b063bff50b16b7..765ac841c56ebb6189200f77a6a224ca6f7890b7 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -926,9 +926,9 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
     char *port_start = NULL;
     char *port_sep = NULL;
 
-    addr = malloc(addrlen);
-    memset(addr, 0, addrlen);
-
+    addr = calloc(addrlen+1, 1);
+    if (!addr)
+      return CURLE_OUT_OF_MEMORY;
 
 #ifdef ENABLE_IPV6
     if(*string_ftpport == '[') {