aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavidson Francis <davidsondfgl@gmail.com>2020-05-11 00:06:20 -0300
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-14 22:59:07 +0200
commitb8fad4bcd02210912de8cbdefcd77e9ca743a575 (patch)
tree6f1f652b2c990ae61056c64367725d225fd5efa6
parent1bca83e8bfdca64fd6374fb6e3403f517c58dcb1 (diff)
downloadsparse-b8fad4bcd02210912de8cbdefcd77e9ca743a575.tar.gz
show-parse: null pointer dereference in do_show_type()
In do_show_type() the first if statement allows passing null pointers, which can cause a null pointer dereference in some cases, which I believe is not the desired behavior. Fix this by changing the first if statement comparison. Signed-off-by: Davidson Francis <davidsondfgl@gmail.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--show-parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/show-parse.c b/show-parse.c
index 044465e9..8a145b88 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -292,7 +292,7 @@ static void do_show_type(struct symbol *sym, struct type_name *name)
int fouled = 0;
deeper:
- if (!sym || (sym->type != SYM_NODE && sym->type != SYM_ARRAY &&
+ if (sym && (sym->type != SYM_NODE && sym->type != SYM_ARRAY &&
sym->type != SYM_BITFIELD)) {
const char *s;
size_t len;