]> granicus.if.org Git - curl/commit
progress_cb: avoid buffer overflow
authorDaniel Stenberg <daniel@haxx.se>
Wed, 9 Nov 2011 21:50:36 +0000 (22:50 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 11 Nov 2011 18:57:49 +0000 (19:57 +0100)
commit10120e6ab545c18a89f8f23006322e2aa23fa15d
treec59fbfaff3c4e03636952544a93aaf373d9c602a
parent082e8a3b03d2c47d237994675bface127ab23c29
progress_cb: avoid buffer overflow

The progress bar output function would blindly use the terminal width
without bounds checking. When using a very wide terminal that caused a
buffer overflow and segfault.

We now limit the max bar with to 255 columns, and I simplified the code
to avoid an extra snprintf and buffer.

Bug: http://curl.haxx.se/bug/view.cgi?id=3435710
Reported by: Alexey Zakhlestin
src/tool_cb_prg.c