]> sjero.net Git - wget/commitdiff
[svn] Don't call rate() with bogus data.
authorhniksic <devnull@localhost>
Fri, 16 Nov 2001 19:38:03 +0000 (11:38 -0800)
committerhniksic <devnull@localhost>
Fri, 16 Nov 2001 19:38:03 +0000 (11:38 -0800)
Submitted by Ian Abbott in <3B7A98A1.24985.9EF692@localhost>

src/ChangeLog
src/ftp.c

index d559fb1a936e65d18bdb68b5cc350086a7aea3eb..07dc71412d63ca4eaf70053af3d1e29eec8a18c3 100644 (file)
@@ -1,3 +1,9 @@
+2001-08-15  Ian Abbott  <abbotti@mev.co.uk>
+
+       * ftp.c (ftp_loop_internal): Avoid a potential buffer overflow in
+         the call to the 'rate' function by moving it past the error
+         checking for the 'getftp' function return value.
+
 2001-11-16  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * html-parse.c (advance_declaration): Use 0x22 instead of '"' or
index f48f1beb583ef329143b105f75cc57d188b303d1..7bcca7ab5664111550491a61da38899e9f31cd74 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -1086,9 +1086,6 @@ ftp_loop_internal (struct urlinfo *u, struct fileinfo *f, ccon *con)
       else
        len = 0;
       err = getftp (u, &len, restval, con);
-      /* Time?  */
-      tms = time_str (NULL);
-      tmrate = rate (len - restval, con->dltime, 0);
 
       if (!rbuf_initialized_p (&con->rbuf))
        con->st &= ~DONE_CWD;
@@ -1126,6 +1123,9 @@ ftp_loop_internal (struct urlinfo *u, struct fileinfo *f, ccon *con)
          /* Not as great.  */
          abort ();
        }
+      /* Time?  */
+      tms = time_str (NULL);
+      tmrate = rate (len - restval, con->dltime, 0);
 
       /* If we get out of the switch above without continue'ing, we've
         successfully downloaded a file.  Remember this fact. */