bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [bug #47882] progress: wget crashes with narrow terminal


From: Jeff Bai
Subject: [Bug-wget] [bug #47882] progress: wget crashes with narrow terminal
Date: Tue, 10 May 2016 04:06:21 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0

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  <address@hidden>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]