tasn pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=6045f24446c55560a7ad9e7631f47bb00b739cf6

commit 6045f24446c55560a7ad9e7631f47bb00b739cf6
Author: Tom Hacohen <t...@stosb.com>
Date:   Tue Dec 8 12:03:09 2015 +0000

    Elm spinner: Fix potential null deref in decimal get function.
    
    This whole code reeks. This generating and parsing strings as a value
    store is hacky and could use an overhaul.
    
    This just fixes the more obvious possible errors (that are maybe not
            even possible, just look possible).
    
    CID1339828
    CID1339829
---
 src/lib/elm_spinner.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c
index 5fe0caa..019ad4d 100644
--- a/src/lib/elm_spinner.c
+++ b/src/lib/elm_spinner.c
@@ -398,7 +398,7 @@ _entry_activated_cb(void *data,
 static int
 _decimal_points_get(const char *label)
 {
-   char result[2];
+   char result[2] = "";
    const char *start = strchr(label, '%');
 
    while (start)
@@ -406,14 +406,16 @@ _decimal_points_get(const char *label)
         if (start[1] != '%')
           {
              start = strchr(start, '.');
-             start++;
+             if (start)
+                start++;
              break;
           }
         else
           start = strchr(start + 2, '%');
      }
 
-   sscanf(start, "%[^f]", result);
+   if (start)
+      sscanf(start, "%[^f]", result);
 
    return atoi(result);
 }

-- 


Reply via email to