diff options
author | George Hazan <ghazan@miranda.im> | 2021-10-08 13:06:12 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-10-08 13:06:12 +0300 |
commit | 4f71cf8247fd6313173cf70f03144fc8c1287d3e (patch) | |
tree | 9179345cdd5e31c37d92b116979f4dab89c54761 | |
parent | fcb451edf5072a325fcd91e005f4348bdeec5cb4 (diff) |
more checks
-rw-r--r-- | protocols/Twitter/src/utility.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
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;
}
|