From: Jihoon Jung Date: Thu, 31 May 2018 05:39:25 +0000 (+0900) Subject: Add error handling for object copy X-Git-Tag: accepted/tizen/4.0/unified/20180531.074234^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c186f0f8ded9dff6dd1536f0f7d14ea6e0dcdc5;p=platform%2Fcore%2Fconnectivity%2Fmtp-responder.git Add error handling for object copy Signed-off-by: Jihoon Jung Change-Id: Id0cf3317302cce12a6956703ddbf8dabed6a17e1 --- diff --git a/include/mtp_config.h b/include/mtp_config.h index eac1d2e..5d37986 100755 --- a/include/mtp_config.h +++ b/include/mtp_config.h @@ -136,8 +136,8 @@ #define MTP_UNKNOWN_METADATAW L"Unknown" /* strlen(/opt/usr/share/crash/) + MTP path len limit */ -#define MTP_MAX_PATHNAME_SIZE (21 + 255) /* except \0 */ -#define MTP_MAX_FILENAME_SIZE (254) /* except \0 */ +#define MTP_MAX_PATHNAME_SIZE (21 + 1024) /* except \0 */ +#define MTP_MAX_FILENAME_SIZE (1024) /* except \0 */ #define MTP_MAX_CMD_BLOCK_SIZE 36 /* Bytes */ diff --git a/packaging/mtp-responder.spec b/packaging/mtp-responder.spec index f16a691..2e4426f 100755 --- a/packaging/mtp-responder.spec +++ b/packaging/mtp-responder.spec @@ -6,7 +6,7 @@ ExcludeArch: %arm aarch64 Name: mtp-responder Summary: Media Transfer Protocol daemon (responder) Version: 0.0.27 -Release: 1 +Release: 2 Group: Network & Connectivity/Other License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/mtp_cmd_handler_util.c b/src/mtp_cmd_handler_util.c index 2b4d495..8bde5db 100755 --- a/src/mtp_cmd_handler_util.c +++ b/src/mtp_cmd_handler_util.c @@ -1595,6 +1595,12 @@ mtp_err_t _hutil_construct_object_entry_prop_list(mtp_uint32 store_id, return MTP_ERROR_STORE_FULL; } + if (store->store_info.free_space <= obj_sz) { + ERR("free space is not enough [%ld bytes]\n", + store->store_info.free_space); + return MTP_ERROR_STORE_FULL; + } + obj_info = _entity_alloc_object_info(); if (obj_info == NULL) { ERR("_entity_alloc_object_info Fail");