summaryrefslogtreecommitdiff
path: root/pango/pango-utils.c
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2013-11-29 12:38:07 +0000
committerPhilip Withnall <philip.withnall@collabora.co.uk>2013-12-02 11:32:33 +0000
commit05f7dcda500e83e5cec87cc05e2ba2f8a6d28a8d (patch)
tree4c1d67690ebc9ceb079ee2291b391ba8161c23ca /pango/pango-utils.c
parent280a23e7f75dac7de0f5ec5cf627bbea21b2242f (diff)
downloadpango-05f7dcda500e83e5cec87cc05e2ba2f8a6d28a8d.tar.gz
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
Diffstat (limited to 'pango/pango-utils.c')
-rw-r--r--pango/pango-utils.c10
1 files 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)
{