Giter VIP home page Giter VIP logo

Comments (7)

xyb3rt avatar xyb3rt commented on September 26, 2024

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 "};
    
  •     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.

xyb3rt avatar xyb3rt commented on September 26, 2024

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.

bitboxer avatar bitboxer commented on September 26, 2024

AndyA can you add this patch to your repo?

from htop-osx.

andyzweb avatar andyzweb commented on September 26, 2024

how can I apply that patch to my copy?

from htop-osx.

xyb3rt avatar xyb3rt commented on September 26, 2024

Something like: `patch -u < FILE'. See the patch man-page for more details.

from htop-osx.

xavierlacot avatar xavierlacot commented on September 26, 2024

I can confirm that applying this patch worked for me. Thanks!

from htop-osx.

stepchud avatar stepchud commented on September 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.