diff options
author | George Hazan <ghazan@miranda.im> | 2021-10-08 12:39:42 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-10-08 12:39:42 +0300 |
commit | fcb451edf5072a325fcd91e005f4348bdeec5cb4 (patch) | |
tree | 18888619136c8521f455ed5e49e260112a1e80ed /protocols | |
parent | cecf1d818a3ac07965d70fe95f33b9ac2d43804b (diff) |
Twitter: fix for rare crash in avatar reader
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Twitter/src/connection.cpp | 3 | ||||
-rw-r--r-- | protocols/Twitter/src/utility.cpp | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index f7ce4421a2..6a35d2002b 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -299,8 +299,7 @@ void CTwitterProto::UpdateAvatarWorker(void *p) debugLogA("***** Updating avatar: %s", data->url.c_str());
mir_cslock lck(avatar_lock_);
- if (Miranda_IsTerminated()) // if miranda is shutting down...
- {
+ if (Miranda_IsTerminated()) { // if miranda is shutting down...
debugLogA("***** Terminating avatar update early: %s", data->url.c_str());
return;
}
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index 7e4c269a79..b7198723e2 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -92,7 +92,8 @@ bool save_url(HNETLIBUSER hNetlib, const CMStringA &url, const CMStringW &filena // Write to file
FILE *f = _wfopen(filename, L"wb");
- fwrite(resp->pData, 1, resp->dataLength, f);
+ if (resp->pData && !IsBadReadPtr(resp->pData, resp->dataLength))
+ fwrite(resp->pData, 1, resp->dataLength, f);
fclose(f);
return true;
|