From 05f7dcda500e83e5cec87cc05e2ba2f8a6d28a8d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 29 Nov 2013 12:38:07 +0000 Subject: pango-utils: Fix a potential strtol(NULL) call parse_int() is called by pango_parse_enum(), which permits the enum string to be NULL. This string is passed directly through to parse_int() and then to strtol(), which is tagged as nonnull. Found by scan-build. https://bugzilla.gnome.org/show_bug.cgi?id=719549 --- pango/pango-utils.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pango/pango-utils.c b/pango/pango-utils.c index b4ad4511..3dfcebde 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -812,8 +812,14 @@ parse_int (const char *word, int *out) { char *end; - long val = strtol (word, &end, 10); - int i = val; + long val; + int i; + + if (word == NULL) + return FALSE; + + val = strtol (word, &end, 10); + i = val; if (end != word && *end == '\0' && val >= 0 && val == i) { -- cgit v1.2.1