summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-07-14 19:24:57 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-07-14 19:24:57 +0300
commit1fae4081a820eb870e8a9639338ecb4d2f1bde70 (patch)
tree667379c02096ae5c4f6e12fd765c1342e342d9f2 /src
parent48d7b407e3c7b8bbd2758b90146dd08e06281745 (diff)
more accurate version of the previous commit
Diffstat (limited to 'src')
-rw-r--r--src/core/stdssl/src/netlibssl.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp
index 0c16f9fdb5..25a5e7d1df 100644
--- a/src/core/stdssl/src/netlibssl.cpp
+++ b/src/core/stdssl/src/netlibssl.cpp
@@ -773,9 +773,15 @@ static void* NetlibSslUnique(SslHandle *ssl, int *cbLen)
bindings = *(SEC_CHANNEL_BINDINGS *)bindings.dwInitiatorOffset;
pBuf += bindings.dwApplicationDataOffset;
if (memcmp(pBuf, "tls-unique:", 11)) {
- CMStringA tmp(' ', bindings.cbApplicationDataLength * 2);
- bin2hex(pBuf, bindings.cbApplicationDataLength, tmp.GetBuffer());
- Netlib_Logf(nullptr, "NetlibSslUnique() failed: bad buffer: %s", tmp.c_str());
+ char tmp[sizeof(bindings) * 2 + 1];
+ bin2hex(&bindings, sizeof(bindings), tmp);
+ Netlib_Logf(nullptr, "NetlibSslUnique() failed: bad buffer: %s", tmp);
+
+ if (!IsBadReadPtr(pBuf, bindings.cbApplicationDataLength)) {
+ ptrA buf((char*)mir_alloc(bindings.cbApplicationDataLength*2 + 1));
+ bin2hex(pBuf, bindings.cbApplicationDataLength, buf);
+ Netlib_Logf(nullptr, "buffer: %s", buf.get());
+ }
return nullptr;
}