yelp/0005-Check-whether-variable-node-is-set-before-dereferenc.patch
2022-11-08 06:29:30 +00:00

37 lines
1.2 KiB
Diff

From 92974634d285448bbf2007a9bcfedf247a26a39b Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 10:55:52 +0200
Subject: [PATCH 05/17] 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);
--
2.19.1