Fix NULL dereference 75/248075/1 accepted/tizen_5.5_unified tizen_5.5 accepted/tizen/5.5/unified/20201126.044945 submit/tizen_5.5/20201123.021354
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 20 Nov 2020 07:35:25 +0000 (16:35 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Fri, 20 Nov 2020 07:35:33 +0000 (16:35 +0900)
Change-Id: I6f429ea470f2f47d9ef31834098c7a7ba261ef7f

agent/download-agent-http-msg-handler.c

index b352947..eff9432 100755 (executable)
@@ -820,9 +820,14 @@ da_bool_t http_msg_response_get_content_disposition(
 
                        /* If it is url encoded string */
                        if (decoded_str) {
-                               char* file_name;
+                               char* file_name = NULL;
                                DA_SECURE_LOGD("Url decoded str = [%s]", decoded_str);
                                file_name = (char*)calloc(1, strlen(decoded_str) + 1);
+                               if (!file_name) {
+                                       DA_LOGE("Out of memory.");
+                                       return DA_FALSE;
+                               }
+
                                strncpy(file_name, decoded_str, strlen(decoded_str));
 
                                NULL_CHECK_AND_FREE(wanted_str);