From 4f71cf8247fd6313173cf70f03144fc8c1287d3e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 8 Oct 2021 13:06:12 +0300 Subject: more checks --- protocols/Twitter/src/utility.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'protocols/Twitter/src') diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index b7198723e2..e693d0b0e7 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -88,13 +88,15 @@ bool save_url(HNETLIBUSER hNetlib, const CMStringA &url, const CMStringW &filena return false; // Create folder if necessary - CreatePathToFileW(filename); + if (CreatePathToFileW(filename) != ERROR_SUCCESS) + return false; // Write to file - FILE *f = _wfopen(filename, L"wb"); - if (resp->pData && !IsBadReadPtr(resp->pData, resp->dataLength)) + if (FILE *f = _wfopen(filename, L"wb")) { fwrite(resp->pData, 1, resp->dataLength, f); - fclose(f); + fclose(f); + } + else return false; return true; } -- cgit v1.2.3