From d9a166bd103483d1e1e0d9a4e5f443340b6a5806 Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Sun, 27 Nov 2022 16:12:00 +0900 Subject: [PATCH] Fix svace issue (file-download writter null check) Change-Id: I35729eb2d6cc647eedb953fc7d9aaf70c3ae84a7 Signed-off-by: Eunki Hong --- dali/internal/imaging/common/file-download.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dali/internal/imaging/common/file-download.cpp b/dali/internal/imaging/common/file-download.cpp index 278375d..2940300 100644 --- a/dali/internal/imaging/common/file-download.cpp +++ b/dali/internal/imaging/common/file-download.cpp @@ -121,10 +121,11 @@ CURLcode DownloadFileDataWithSize(CURL* curlHandle, Dali::Vector& dataB // create Dali::Internal::Platform::FileWriter fileWriter(dataBuffer, dataSize); FILE* dataBufferFilePointer = fileWriter.GetFile(); - setbuf(dataBufferFilePointer, NULL); // Turn buffering off if(NULL != dataBufferFilePointer) { + setbuf(dataBufferFilePointer, NULL); // Turn buffering off + // we only want the body which contains the file data curl_easy_setopt(curlHandle, CURLOPT_HEADER, EXCLUDE_HEADER); curl_easy_setopt(curlHandle, CURLOPT_NOBODY, INCLUDE_BODY); @@ -136,6 +137,12 @@ CURLcode DownloadFileDataWithSize(CURL* curlHandle, Dali::Vector& dataB // synchronous request of the body data result = curl_easy_perform(curlHandle); } + else + { + DALI_LOG_ERROR("Fail to open buffer writter with size : %zu!\n", dataSize); + // @todo : Need to check that is it correct error code? + result = CURLE_READ_ERROR; + } return result; } -- 2.7.4