diff options
author | root <root@rshg054.dnsready.net> | 2011-10-20 23:14:58 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2011-10-20 23:14:58 +0000 |
commit | 1b21445a8e9097b0bb0542ed847fbb1eb832848f (patch) | |
tree | de9d1c80c9330efe48f043d8c6cc059ad5640151 /extra/htop/fix-segfault-small-terminal.patch | |
parent | 1a136cf48dd7f710f38ff998182508f5a0d41c35 (diff) |
Thu Oct 20 23:14:58 UTC 2011
Diffstat (limited to 'extra/htop/fix-segfault-small-terminal.patch')
-rw-r--r-- | extra/htop/fix-segfault-small-terminal.patch | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/extra/htop/fix-segfault-small-terminal.patch b/extra/htop/fix-segfault-small-terminal.patch new file mode 100644 index 000000000..c55146492 --- /dev/null +++ b/extra/htop/fix-segfault-small-terminal.patch @@ -0,0 +1,24 @@ +--- trunk/Meter.c 2011/08/26 20:52:35 229 ++++ trunk/Meter.c 2011/08/26 20:55:09 230 +@@ -264,13 +264,19 @@ + + w--; + x++; +- char bar[w]; ++ ++ if (w < 1) { ++ attrset(CRT_colors[RESET_COLOR]); ++ return; ++ } ++ char bar[w + 1]; + + int blockSizes[10]; + for (int i = 0; i < w; i++) + bar[i] = ' '; + +- sprintf(bar + (w-strlen(buffer)), "%s", buffer); ++ const size_t barOffset = w - MIN(strlen(buffer), w); ++ snprintf(bar + barOffset, w - barOffset + 1, "%s", buffer); + + // First draw in the bar[] buffer... + double total = 0.0; |