Fix prevent issue
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 29 May 2013 06:28:38 +0000 (15:28 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Wed, 29 May 2013 06:28:38 +0000 (15:28 +0900)
[model] Redwood
[binary_type] AP
[customer] Docomo/Orange/Open
[issue#] CID-53141
[problem] Dereference after null check (FORWARD NULL)
[cause] before use the string compare, argument should be checked
[solution] check the arguments of strcmp
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I0ed827fd342d043dbbdc9608642c51338a7c41f6

lib/src/icon.c
packaging/libshortcut.spec

index b4eddce..99d5ea6 100644 (file)
@@ -404,9 +404,18 @@ static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, con
                block->idx = handle->last_idx++;
                handle->block_list = dlist_append(handle->block_list, block);
        } else {
-               if (strcmp(block->type, type) || strcmp(block->target_id, target_id)) {
-                       ErrPrint("type or target id is not valid (%s, %s) or (%s, %s)\n",
-                                               block->type, type, block->target_id, target_id);
+               if (strcmp(block->type, type)) {
+                       ErrPrint("type is not valid (%s, %s)\n", block->type, type);
+                       return -EINVAL;
+               }
+
+               if ((block->target_id && !target_id) || (!block->target_id && target_id)) {
+                       ErrPrint("type is not valid (%s, %s)\n", block->type, type);
+                       return -EINVAL;
+               }
+
+               if (block->target_id && target_id && strcmp(block->target_id, target_id)) {
+                       ErrPrint("type is not valid (%s, %s)\n", block->type, type);
                        return -EINVAL;
                }
 
index 8a858f1..7c5cd02 100644 (file)
@@ -1,6 +1,6 @@
 Name: libshortcut
 Summary: Shortcut add feature supporting library
-Version: 0.6.2
+Version: 0.6.3
 Release: 0
 Group: HomeTF/Framework
 License: Apache License