Fix a potential null ptr dereference 30/213130/2
authorMichal Bloch <m.bloch@samsung.com>
Fri, 30 Aug 2019 12:03:47 +0000 (14:03 +0200)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 3 Sep 2019 01:12:02 +0000 (01:12 +0000)
Change-Id: I5541047d606dea988b5ce5b54cb7394a3aba78ac
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/shared/logprint.c

index ef94ce6..6328cc1 100644 (file)
@@ -757,6 +757,8 @@ char *log_format_json(
 #else
                ptm = localtime(&time_t_temp);
 #endif
+               if (!ptm)
+                       return NULL;
                strftime(recv_real, sizeof recv_real, "\"recv_real\":\"%FT%T%z\",", ptm);
        }
 
@@ -769,6 +771,8 @@ char *log_format_json(
 #else
                ptm = localtime(&time_t_temp);
 #endif
+               if (!ptm)
+                       return NULL;
                strftime(sent_real, sizeof sent_real, "\"sent_real\":\"%FT%T%z\",", ptm);
        }