arrfab / rpms / libreport

Forked from rpms/libreport 5 years ago
Clone

Blame SOURCES/0013-coverity-Check-null-pointer-before-dereferencing-it-.patch

91b162
From 570496fa4d39fd5eaa6216c7962c3875794571c2 Mon Sep 17 00:00:00 2001
91b162
From: Martin Kutlak <mkutlak@redhat.com>
91b162
Date: Mon, 20 Aug 2018 16:13:15 +0200
91b162
Subject: [PATCH] coverity: Check null pointer before dereferencing it #def35
91b162
91b162
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
91b162
---
91b162
 src/lib/xatonum.c | 2 +-
91b162
 1 file changed, 1 insertion(+), 1 deletion(-)
91b162
91b162
diff --git a/src/lib/xatonum.c b/src/lib/xatonum.c
91b162
index 510d7667..8381ec37 100644
91b162
--- a/src/lib/xatonum.c
91b162
+++ b/src/lib/xatonum.c
91b162
@@ -96,7 +96,7 @@ int xatoi_positive(const char *numstr)
91b162
 
91b162
 int try_atoi(const char *numstr, int *value)
91b162
 {
91b162
-    if (*numstr != '-')
91b162
+    if (numstr != NULL && *numstr != '-')
91b162
         return try_atoi_positive(numstr, value);
91b162
 
91b162
     unsigned tmp;
91b162
-- 
91b162
2.17.1
91b162