summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBen Dooks <ben.dooks@codethink.co.uk>2018-10-29 15:39:48 +0000
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-11-02 12:32:07 +0100
commit06a45458a3618da69385eeda55bd8b64d6dd547f (patch)
treede0556376b94ddeff58154e783d55b0d2b5a530a
parentc3fc97285416da124059433c9edb91796ee5e010 (diff)
downloadsparse-06a45458a3618da69385eeda55bd8b64d6dd547f.tar.gz
tokenize: check show_string() for NULL pointer
Fix issue where show_string() being passed a NULL pointer by accident. This only happened during debugging, but would be a useful addition to the checks in this function. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--tokenize.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tokenize.c b/tokenize.c
index fa7890d3..e98684ec 100644
--- a/tokenize.c
+++ b/tokenize.c
@@ -124,7 +124,7 @@ const char *show_string(const struct string *string)
char *ptr;
int i;
- if (!string->length)
+ if (!string || !string->length)
return "<bad_string>";
ptr = buffer;
*ptr++ = '"';