Validate find_pkgname before use it.
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 25 Sep 2014 05:33:39 +0000 (14:33 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 25 Sep 2014 05:33:39 +0000 (14:33 +0900)
If a user calls set_extra_info function before create a window,
it will access the uninitialized function pointer.

To guide them to do not use this API before creating window is not enough.
So this patch should need to be applied. to prevent from unexpected crash issue.

[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: I53468147ba4339557a7b4f59c3c5d32bcc6805a1

src/dynamicbox.c

index 1d873cf..c422fef 100644 (file)
@@ -1216,6 +1216,15 @@ PUBLIC int dynamicbox_set_extra_info(const char *id, const char *content, const
                return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
        }
 
+       if (!s_info.find_pkgname) {
+               s_info.find_pkgname = dlsym(RTLD_DEFAULT, "livebox_find_pkgname");
+               if (!s_info.find_pkgname) {
+                       ErrPrint("Failed to find a \"livebox_find_pkgname\"\n");
+                       free(uri);
+                       return DBOX_STATUS_ERROR_FAULT;
+               }
+       }
+
        pkgname = s_info.find_pkgname(uri);
        if (!pkgname) {
                ErrPrint("Failed to find a package (%s)\n", uri);