Skip to content
Snippets Groups Projects
Commit d23ad38a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix heap corruption in smb_getattachment() for blank attachments

MSVC detected heap corruption from this function when the attachment was 0-bytes in length. Good catch.
parent acede36f
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -545,7 +545,7 @@ uint8_t* smb_getattachment(smbmsg_t* msg, char* buf, char* filename, size_t file
if(strStartsWith_i(msg->content_type, "multipart/") > 0) {
txt = mime_getpart(buf, msg->content_type, /* match-type: */NULL, 0, &xfer_encoding, /* charset: */NULL
,/* attachment: */filename, filename_len, index);
if(txt != NULL && xfer_encoding == CONTENT_TRANFER_ENCODING_BASE64) {
if(txt != NULL && *txt && xfer_encoding == CONTENT_TRANFER_ENCODING_BASE64) {
size_t len = strlen(txt);
memmove(buf, txt, len + 1);
int result = b64_decode(buf, len, buf, len);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment