From 88c8a10294620690a63de46d1314fb549f99e3a7 Mon Sep 17 00:00:00 2001 From: Piotr Piastucki Date: Wed, 11 Nov 2015 10:48:53 +0000 Subject: Bugfix for #1087 git-svn-id: http://svn.miranda-ng.org/main/trunk@15708 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MSN/src/msn_commands.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'protocols') diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 275ed84328..f6e7e74084 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -952,7 +952,9 @@ LBL_InvalidCommand: MimeHeaders tHeader; HReadBuffer buf(info, 0); - char* msgBody = tHeader.readFromBuffer((char*)buf.surelyRead(atol(data.strMsgBytes))); + BYTE *msgb = buf.surelyRead(atol(data.strMsgBytes)); + if (!msgb) break; + char* msgBody = tHeader.readFromBuffer((char*)msgb); replaceStr(msnRegistration,tHeader["Set-Registration"]); if (!mir_strcmp(data.typeId, "CON")) { @@ -995,6 +997,7 @@ LBL_InvalidCommand: } else { /* Skype username/pass login */ + if (!msgBody) break; ezxml_t xmlcnt = ezxml_parse_str(msgBody, mir_strlen(msgBody)); ezxml_t xmlnonce = ezxml_child(xmlcnt, "nonce"); if (xmlnonce) { @@ -1028,7 +1031,9 @@ LBL_InvalidCommand: MimeHeaders tHeader; HReadBuffer buf(info, 0); - char* msgBody = tHeader.readFromBuffer((char*)buf.surelyRead(atol(data.strMsgBytes))); + BYTE *msgb = buf.surelyRead(atol(data.strMsgBytes)); + if (!msgb) break; + char* msgBody = tHeader.readFromBuffer((char*)msgb); ezxml_t xmli; if (tHeader["Set-Registration"]) replaceStr(msnRegistration,tHeader["Set-Registration"]); @@ -1263,7 +1268,9 @@ LBL_InvalidCommand: MimeHeaders tHeader; HReadBuffer buf(info, 0); - char* msgBody = tHeader.readFromBuffer((char*)buf.surelyRead(atol(data.strMsgBytes))); + BYTE *msgb = buf.surelyRead(atol(data.strMsgBytes)); + if (!msgb) break; + char* msgBody = tHeader.readFromBuffer((char*)msgb); if (tHeader["Set-Registration"]) replaceStr(msnRegistration,tHeader["Set-Registration"]); if (cmdString[1]=='N') { // PNG @@ -1314,7 +1321,9 @@ LBL_InvalidCommand: MimeHeaders tHeader; HReadBuffer buf(info, 0); - char* msgBody = tHeader.readFromBuffer((char*)buf.surelyRead(atol(data.strMsgBytes))); + BYTE *msgb = buf.surelyRead(atol(data.strMsgBytes)); + if (!msgb) break; + char* msgBody = tHeader.readFromBuffer((char*)msgb); if (!mir_strcmp(data.typeId, "CON")) { ezxml_t xmlxfr = ezxml_parse_str(msgBody, mir_strlen(msgBody)); ezxml_t xmltgt = ezxml_child(xmlxfr, "target"); -- cgit v1.2.3