Comments (7)
The fuFunctions array for the Sort Screen's FunctionBar is not ended with a NULL Pointer, thus strdup reads from invalid address when creating this FunctionBar. The following patch (unified diff) adds a NULL Pointer to the two fuFunctions arrays in htop.c not ending in an NULL pointer:
--- htop.c.orig 2010-01-13 18:04:07.000000000 +0100
+++ htop.c 2010-01-13 15:29:55.000000000 +0100
@@ -651,7 +651,7 @@
Panel* affinityPanel = AffinityPanel_new(pl->processorCount, curr);
-
char\* fuFunctions[2] = {"Set ", "Cancel "};
-
@@ -690,7 +690,7 @@
char\* fuFunctions[] = {"Set ", "Cancel ", NULL}; void\* set = pickFromVector(panel, affinityPanel, 15, headerHeight, fuFunctions, defaultBar); if (set) { unsigned long new = AffinityPanel_getAffinity(affinityPanel);
{
Panel* sortPanel = Panel_new(0, 0, 0, 0, LISTITEM_CLASS, true, ListItem_compare);
Panel_setHeader(sortPanel, "Sort by"); -
char\* fuFunctions[2] = {"Sort ", "Cancel "};
-
char\* fuFunctions[] = {"Sort ", "Cancel ", NULL}; ProcessField\* fields = pl->fields; for (int i = 0; fields[i]; i++) { char\* name = String_trim(Process_fieldTitles[fields[i]]);
from htop-osx.
Sorry, I forgot the
tags!--- htop.c.orig 2010-01-13 18:04:07.000000000 +0100 +++ htop.c 2010-01-13 15:29:55.000000000 +0100 @@ -651,7 +651,7 @@ Panel* affinityPanel = AffinityPanel_new(pl->processorCount, curr); - char* fuFunctions[2] = {"Set ", "Cancel "}; + char* fuFunctions[] = {"Set ", "Cancel ", NULL}; void* set = pickFromVector(panel, affinityPanel, 15, headerHeight, fuFunctions, defaultBar); if (set) { unsigned long new = AffinityPanel_getAffinity(affinityPanel); @@ -690,7 +690,7 @@ { Panel* sortPanel = Panel_new(0, 0, 0, 0, LISTITEM_CLASS, true, ListItem_compare); Panel_setHeader(sortPanel, "Sort by"); - char* fuFunctions[2] = {"Sort ", "Cancel "}; + char* fuFunctions[] = {"Sort ", "Cancel ", NULL}; ProcessField* fields = pl->fields; for (int i = 0; fields[i]; i++) { char* name = String_trim(Process_fieldTitles[fields[i]]);from htop-osx.
AndyA can you add this patch to your repo?
from htop-osx.
how can I apply that patch to my copy?
from htop-osx.
Something like: `patch -u < FILE'. See the patch man-page for more details.
from htop-osx.
I can confirm that applying this patch worked for me. Thanks!
from htop-osx.
See my recent comment/pull request for the applied patch. Hopefully AndyA will accept it since I like htop on osx and this was the one bug that was buggin' me. :)
from htop-osx.
Related Issues (14)
- malloc issue on snow leopard (10.6.2) HOT 9
- htop crashes when opened in iTerm2 tab HOT 1
- Unusual behavior when Multi-threading is disabled HOT 1
- Wrong instructions in INSTALL HOT 2
- SMC read errors flooding system.log HOT 2
- Possible breakage under OSX 10.9.3 (use after free) HOT 5
- htop-osx doesn't actually report on processes anymore. HOT 2
- No `filter` feature? HOT 1
- Close up this fork?
- configure: error: Cannot find /proc/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help. HOT 3
- Physical Free Memory Reported Wrong HOT 2
- htop fails to execute on 10.7.2 HOT 2
- can't build this outside of macports - what am i missing? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htop-osx.