Name: libmedia-service
Summary: Media information service library for multimedia applications
-Version: 0.2.58
+Version: 0.2.59
Release: 0
Group: System/Libraries
License: Apache-2.0 and public domain
media_svc_error("UID [%d] does not belong to 'users' group!", uid);
return NULL;
}
- sprintf(passwd_str, "%s/%s", userinfo->pw_dir, MEDIA_CONTENT_PATH);
+ snprintf(passwd_str, sizeof(passwd_str), "%s/%s", userinfo->pw_dir, MEDIA_CONTENT_PATH);
result_passwd = g_strdup(passwd_str);
}
char *internal_path = _media_svc_get_path(uid);
if ((STRING_VALID(internal_path) && (strcmp(folder_path, internal_path) == 0)) ||
- strcmp(folder_path, MEDIA_ROOT_PATH_SDCARD) == 0 ||
+ (STRING_VALID(MEDIA_ROOT_PATH_SDCARD) && strcmp(folder_path, MEDIA_ROOT_PATH_SDCARD) == 0) ||
(STRING_VALID(MEDIA_ROOT_PATH_CLOUD) && strcmp(folder_path, MEDIA_ROOT_PATH_CLOUD) == 0)) {
media_svc_debug("ROOT PATH [%s]", folder_path);
*is_root = TRUE;
if (STRING_VALID(internal_path) && (strncmp(path, internal_path, strlen(internal_path)) == 0))
next_pos = strlen(internal_path);
- else if (strncmp(path, MEDIA_ROOT_PATH_SDCARD, strlen(MEDIA_ROOT_PATH_SDCARD)) == 0)
+ else if (STRING_VALID(MEDIA_ROOT_PATH_SDCARD) && strncmp(path, MEDIA_ROOT_PATH_SDCARD, strlen(MEDIA_ROOT_PATH_SDCARD)) == 0)
next_pos = strlen(MEDIA_ROOT_PATH_SDCARD);
else if (STRING_VALID(MEDIA_ROOT_PATH_CLOUD) && (strncmp(path, MEDIA_ROOT_PATH_CLOUD, strlen(MEDIA_ROOT_PATH_CLOUD)) == 0))
next_pos = strlen(MEDIA_ROOT_PATH_CLOUD);
- else if (strncmp(path, MEDIA_ROOT_PATH_EXTERNAL, strlen(MEDIA_ROOT_PATH_EXTERNAL)) == 0)
+ else if (STRING_VALID(MEDIA_ROOT_PATH_EXTERNAL) && strncmp(path, MEDIA_ROOT_PATH_EXTERNAL, strlen(MEDIA_ROOT_PATH_EXTERNAL)) == 0)
next_pos = strlen(MEDIA_ROOT_PATH_EXTERNAL);
else {
media_svc_error("Invalid Path");
media_svc_error("UID [%d] does not belong to 'users' group!", uid);
return NULL;
}
- sprintf(passwd_str, "%s/share/media/.thumb/thumb_default.png", userinfo->pw_dir);
+ snprintf(passwd_str, sizeof(passwd_str), "%s/share/media/.thumb/thumb_default.png", userinfo->pw_dir);
result_passwd = g_strdup(passwd_str);
}
char *remain_path = NULL;
int remain_len = 0;
- if (strncmp(path, MEDIA_ROOT_PATH_INTERNAL, strlen(MEDIA_ROOT_PATH_INTERNAL)) == 0) {
+ if (STRING_VALID(MEDIA_ROOT_PATH_INTERNAL) && strncmp(path, MEDIA_ROOT_PATH_INTERNAL, strlen(MEDIA_ROOT_PATH_INTERNAL)) == 0) {
_strncpy_safe(storage_id, MEDIA_SVC_DB_TABLE_MEDIA, MEDIA_SVC_UUID_SIZE+1);
return MS_MEDIA_ERR_NONE;
}
media_svc_error("UID [%d] does not belong to 'users' group!", uid);
return NULL;
}
- sprintf(passwd_str, "%s/share/media/.thumb", userinfo->pw_dir);
+ snprintf(passwd_str, sizeof(passwd_str), "%s/share/media/.thumb", userinfo->pw_dir);
result_passwd = g_strdup(passwd_str);
}
struct dirent entry;
struct dirent *result;
struct stat st;
- char filename[MEDIA_SVC_PATHNAME_SIZE] = {0};
+ char filename[MEDIA_SVC_PATHNAME_SIZE] = {0, };
DIR *dir = NULL;
dir = opendir(dir_path);
media_svc_error("UID [%d] does not belong to 'users' group!", uid);
return NULL;
}
- sprintf(passwd_str, "%s/share/media/.thumb/phone", userinfo->pw_dir);
+ snprintf(passwd_str, sizeof(passwd_str), "%s/share/media/.thumb/phone", userinfo->pw_dir);
result_passwd = g_strdup(passwd_str);
}
media_svc_error("UID [%d] does not belong to 'users' group!", uid);
return NULL;
}
- sprintf(passwd_str, "%s/share/media/.thumb/mmc", userinfo->pw_dir);
+ snprintf(passwd_str, sizeof(passwd_str), "%s/share/media/.thumb/mmc", userinfo->pw_dir);
result_passwd = g_strdup(passwd_str);
}
{
if (STRING_VALID(path)) {
char *internal_path = _media_svc_get_path(uid);
- if (strncmp(path, internal_path, strlen(internal_path)) == 0) {
+ if (STRING_VALID(internal_path) && (strncmp(path, internal_path, strlen(internal_path)) == 0)) {
*storage_type = MEDIA_SVC_STORAGE_INTERNAL;
} else if (STRING_VALID(MEDIA_ROOT_PATH_SDCARD) && (strncmp(path, MEDIA_ROOT_PATH_SDCARD, strlen(MEDIA_ROOT_PATH_SDCARD)) == 0)) {
*storage_type = MEDIA_SVC_STORAGE_EXTERNAL;
const char *dirpath = (storage_type == MEDIA_SVC_STORAGE_INTERNAL) ? internal_thumb_path : external_thumb_path;
/* remove thumbnails */
- ret = _media_svc_remove_all_files_in_dir(dirpath);
+ if (STRING_VALID(dirpath))
+ ret = _media_svc_remove_all_files_in_dir(dirpath);
SAFE_FREE(internal_thumb_path);
SAFE_FREE(external_thumb_path);
media_svc_retv_if(ret != MS_MEDIA_ERR_NONE, ret);
/* If old thumb path is default or not */
char *default_thumbnail_path = _media_svc_get_thumb_default_path(uid);
if (STRING_VALID(default_thumbnail_path) && (strncmp(media_thumb_path, default_thumbnail_path, strlen(default_thumbnail_path)) == 0)) {
- strncpy(media_new_thumb_path, default_thumbnail_path, sizeof(media_new_thumb_path));
+ strncpy(media_new_thumb_path, default_thumbnail_path, sizeof(media_new_thumb_path) - 1);
} else {
ret = _media_svc_get_storage_type_by_path(replaced_path, &storage_type, uid);
if (ret != MS_MEDIA_ERR_NONE) {