[yelp] Check whether variable node is set before dereferencing it



commit 14d995eeb38b2173615736754bc9288670f185c0
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Jul 23 10:55:52 2018 +0200

    Check whether variable node is set before dereferencing it
    
    yelp-3.28.1/libyelp/yelp-info-parser.c:766: dereference: Dereferencing a pointer that might be null 
"node" when calling "strncmp".

 libyelp/yelp-info-parser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libyelp/yelp-info-parser.c b/libyelp/yelp-info-parser.c
index d0e767bc..0c383bfe 100644
--- a/libyelp/yelp-info-parser.c
+++ b/libyelp/yelp-info-parser.c
@@ -734,7 +734,7 @@ process_page (GtkTreeStore *tree,
          g_free (next);
          next = NULL;
        }
-       if (g_str_equal (node, "Top") && prev != NULL) {
+       if (node && g_str_equal (node, "Top") && prev != NULL) {
          g_free (prev);
          prev = NULL;
        }
@@ -763,7 +763,7 @@ process_page (GtkTreeStore *tree,
        }
        if (prev && g_ascii_strncasecmp (prev, "(dir)", 5))
          {
-           if (strncmp (node, "Top", 3)) {
+           if (node && strncmp (node, "Top", 3)) {
              /* Special case the Top node to always appear first */
            } else {
              page = node2page (nodes2pages, prev);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]