Follow-up Comment #2, bug #47882 (project wget):

A proposed patch by huntxu <mhuntxu AT gmail dot com>, his original comment is
as follows:

The three lines [in the problematic commit] did not check if size of padding
would be negative, and memset() therefore fails with a negative value.

diff --git a/src/progress.c b/src/progress.c
index 93f6246..3798ef6 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -1164,8 +1164,10 @@ create_image (struct bar_progress *bp, double
dl_total_time, bool done)
     }
 
   padding = bp->width - count_cols (bp->buffer);
-  memset (p, ' ', padding);
-  p += padding;
+  if (padding > 0) {
+    memset (p, ' ', padding);
+    p += padding;
+  }
   *p = ' ';
 
   /* 2014-11-14  Darshit Shah  <[email protected]>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47882>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


Reply via email to