Fix the svace issue (WGID : 212857) 56/128956/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Fri, 12 May 2017 06:50:12 +0000 (15:50 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Fri, 12 May 2017 06:50:12 +0000 (15:50 +0900)
Change-Id: Iaa3c17a61273f5a816de42d449e650159810391e
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
bt-otp/bt-otpserver.c

index 3eff442..cc514cb 100644 (file)
@@ -669,13 +669,15 @@ void convert_to_hex(struct object_metadata *object, char *type, char *value)
 
                localtime_r(&(object->first_created), tm);
 
-               value[1] = ((tm->tm_year+1900) >> 8) & 0xFF;
-               value[0] = (tm->tm_year+1900) & 0xFF;
-               value[2] = (tm->tm_mon+1) & 0xFF;
-               value[3] = tm->tm_mday & 0xFF;
-               value[4] = tm->tm_hour & 0xFF;
-               value[5] = tm->tm_min & 0xFF;
-               value[6] = tm->tm_sec & 0xFF;
+               if (tm) {
+                       value[1] = ((tm->tm_year+1900) >> 8) & 0xFF;
+                       value[0] = (tm->tm_year+1900) & 0xFF;
+                       value[2] = (tm->tm_mon+1) & 0xFF;
+                       value[3] = tm->tm_mday & 0xFF;
+                       value[4] = tm->tm_hour & 0xFF;
+                       value[5] = tm->tm_min & 0xFF;
+                       value[6] = tm->tm_sec & 0xFF;
+               }
 
        } else if (!g_strcmp0(type, "id")) {