Skip to content
Snippets Groups Projects
Commit 551d3442 authored by rswindell's avatar rswindell
Browse files

smb_countattachments() now works - needed a filename buffer even though we

don't care about filenames.
smb/mime_getattachment() now supports filenames with spaces in them. If we need
to strip or convert to short filenames, do that in the application/script code,
not in smblib.
parent 1413ba04
No related branches found
No related tags found
No related merge requests found
......@@ -313,9 +313,6 @@ static BOOL mime_getattachment(char* beg, char* end, char* attachment, size_t at
term = filename + sizeof(fname) - 1;
memcpy(fname, filename, term - filename);
fname[term - filename] = 0;
term = fname;
FIND_WHITESPACE(term);
*term = 0;
if(attachment != NULL && attachment_len > 0) {
strncpy(attachment, getfname(fname), attachment_len);
attachment[attachment_len - 1] = '\0';
......@@ -476,7 +473,8 @@ ulong SMBCALL smb_countattachments(smb_t* smb, smbmsg_t* msg, const char* body)
char* tmp;
while((tmp = strdup(buf)) != NULL) {
uint8_t* attachment = smb_getattachment(msg, tmp, NULL, 0, NULL, count);
char filename[MAX_PATH + 1];
uint8_t* attachment = smb_getattachment(msg, tmp, filename, sizeof(filename), NULL, count);
free(tmp);
if(attachment == NULL)
break;
......
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