else
LOGE("privilege_info_get_privacy_display() failed. ret = %d, privacy = %s", ret, privacy);
- return "";
+ return NULL;
}
static char* __accessible_content_name_cb(void *data, Evas_Object *obj)
static char* __make_message(const char* format, const char* pkg_label, const char* privacy)
{
+ if (pkg_label == NULL || privacy == NULL)
+ return NULL;
+
char* message = NULL;
int ret = 0;
LOGD("message : %s", message);
return message;
}
- return "";
+ return NULL;
}
static char* __get_pkg_label(const char* pkgid)
if (label != NULL)
pkg_label = strdup(label);
+ if (pkg_label == NULL)
+ LOGE("strdup() of pkg_label failed.");
+
if (handle != NULL)
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- if (pkg_label != NULL)
- return pkg_label;
-
- return "";
+ return pkg_label;
}
static char* __get_message(const char* pkgid, const char* privacy)
char* pkg_label = __get_pkg_label(pkgid);
char* privacy_display = __get_privacy_display(privacy);
char* message = __make_message(MSG_POPUP_TEXT, pkg_label, privacy_display);
- if (strlen(pkg_label) > 0)
+ if (pkg_label != NULL)
free(pkg_label);
- if (strlen(privacy_display) > 0)
+ if (privacy_display != NULL)
free(privacy_display);
+ if (message == NULL)
+ ui_app_exit();
return message;
}
static void __set_popup_contents(app_data_s *ad)
free(message);
if (!strcmp(ad->launch_type, "multi")) {
char counter[COUNTER_LEN];
- int ret = sprintf(counter, "%d / %d", (ad->privacy_idx) + 1, ad->privacy_num);
- LOGD("counter %s", counter);
- elm_object_part_text_set(ad->layout, "elm.privilege_counter", counter);
+ int ret = snprintf(counter, COUNTER_LEN, "%d / %d", (ad->privacy_idx) + 1, ad->privacy_num);
+ if (ret < 0 || ret >= COUNTER_LEN) {
+ LOGE("snprintf() for counter failed. ret = %d", ret);
+ } else {
+ LOGD("counter %s", counter);
+ elm_object_part_text_set(ad->layout, "elm.privilege_counter", counter);
+ }
}
}