summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2018-02-09 13:28:37 +0900
committerMinje Ahn <minje.ahn@samsung.com>2018-02-09 13:28:37 +0900
commit391b4f7106952669d6f8ced22eb7b65969e05e47 (patch)
tree078c2dee434b443b915a63909ebb3e563f051f76
parent9c2733535f7757020ec5b8414f4ced00106a866d (diff)
downloadlibmedia-thumbnail-391b4f7106952669d6f8ced22eb7b65969e05e47.tar.gz
libmedia-thumbnail-391b4f7106952669d6f8ced22eb7b65969e05e47.tar.bz2
libmedia-thumbnail-391b4f7106952669d6f8ced22eb7b65969e05e47.zip
[SATIZENVUL-1315,1316] Reinforced the missing codesubmit/tizen_4.0/20180208.082729accepted/tizen/4.0/unified/20180213.132827
Change-Id: I8dddd050da05e8c843aaf4a1df42ba37a4363b45 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
-rwxr-xr-xserver/thumb-server-internal.c3
-rwxr-xr-xsrc/ipc/media-thumb-ipc.c14
-rwxr-xr-xsrc/media-thumbnail.c4
3 files changed, 16 insertions, 5 deletions
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 0ae6cca..0e356b1 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -130,7 +130,7 @@ gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpoi
SAFE_FREE(credentials.smack);
SAFE_FREE(credentials.uid);
- thumb_warn_slog("Received [%d] %s(%d) from PID(%d)", recv_msg.msg_type, recv_msg.org_path, strlen(recv_msg.org_path), recv_msg.pid);
+ thumb_warn_slog("Received [%d] %.*s(%d) from PID(%d)", recv_msg.msg_type, MAX_FILEPATH_LEN, recv_msg.org_path, strlen(recv_msg.org_path), recv_msg.pid);
if (recv_msg.msg_type != THUMB_REQUEST_KILL_SERVER)
_thumb_daemon_process_job(&recv_msg, &res_msg);
@@ -195,7 +195,6 @@ static gboolean __thumb_server_send_msg_to_agent(int msg_type)
serv_addr.sun_family = AF_UNIX;
SAFE_STRLCPY(serv_addr.sun_path, THUMB_COMM_SOCK_PATH, sizeof(serv_addr.sun_path));
-
/* Connecting to the thumbnail server */
if (connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
thumb_stderror("connect");
diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c
index 93c87c5..1b9393d 100755
--- a/src/ipc/media-thumb-ipc.c
+++ b/src/ipc/media-thumb-ipc.c
@@ -270,7 +270,19 @@ int _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg)
}
memcpy(msg, buf, header_size);
- //thumb_dbg("thumb_size : %d", msg->thumb_size);
+
+ if (strlen(msg->org_path) == 0 || strlen(msg->org_path) >= MAX_FILEPATH_LEN) {
+ thumb_err("org_path size is invalid %d", strlen(msg->org_path));
+
+ return MS_MEDIA_ERR_SOCKET_RECEIVE;
+ }
+
+ /* it can be empty string */
+ if (strlen(msg->dst_path) >= MAX_FILEPATH_LEN) {
+ thumb_err("dst_path size is invalid %d", strlen(msg->dst_path));
+
+ return MS_MEDIA_ERR_SOCKET_RECEIVE;
+ }
SAFE_FREE(buf);
if (msg->thumb_size < 0) {
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index 2fb3065..da97a69 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -76,8 +76,8 @@ int thumbnail_request_from_db_async(unsigned int request_id, const char *origin_
}
if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
- thumb_err("Original path(%s) doesn't exist.", origin_path);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
+ thumb_err("Original path(%s) doesn't exist.", origin_path);
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
}
ms_user_storage_type_e store_type = -1;