Add error handling for object copy 87/180587/1 accepted/tizen/4.0/unified/20180531.074234 submit/tizen_4.0/20180531.054557
authorJihoon Jung <jh8801.jung@samsung.com>
Thu, 31 May 2018 05:39:25 +0000 (14:39 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Thu, 31 May 2018 05:40:10 +0000 (14:40 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: Id0cf3317302cce12a6956703ddbf8dabed6a17e1

include/mtp_config.h
packaging/mtp-responder.spec
src/mtp_cmd_handler_util.c

index eac1d2e..5d37986 100755 (executable)
 #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 */
 
index f16a691..2e4426f 100755 (executable)
@@ -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
index 2b4d495..8bde5db 100755 (executable)
@@ -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");