Check empty string for file path 91/167791/2 accepted/tizen/4.0/unified/20180131.050459 accepted/tizen/unified/20180125.060657 submit/tizen/20180123.122734 submit/tizen_4.0/20180123.123033
authorDaeheyon Jung <darrenh.jung@samsung.com>
Mon, 22 Jan 2018 05:51:28 +0000 (14:51 +0900)
committerDaeheyon Jung <darrenh.jung@samsung.com>
Tue, 23 Jan 2018 12:26:29 +0000 (21:26 +0900)
Change-Id: I367cb9b2e9665d696596fadcc1588684dc682ed9
Signed-off-by: Daeheyon Jung <darrenh.jung@samsung.com>
src/mime_type.c

index b04239c..296ba6d 100755 (executable)
@@ -146,6 +146,9 @@ int mime_type_get_mime_type_for_file(const char *file_path, char **mime_type)
        if (file_path == NULL || mime_type == NULL)
                return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
 
+       if (file_path[0] == '\0')
+               return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, "the given file path is empry string");
+
        if (access(file_path, R_OK) < 0) {
                if (errno == EACCES)
                        return mime_type_error(MIME_TYPE_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);