Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Mem Access when a file in an email doesn't have a filename #68

Open
dwsolberg opened this issue Dec 30, 2012 · 0 comments
Open

Bad Mem Access when a file in an email doesn't have a filename #68

dwsolberg opened this issue Dec 30, 2012 · 0 comments

Comments

@dwsolberg
Copy link

Sometimes a file will arrive with no filename property set. Calling decoded filename on such an attachment results in a memory access crash -- the nil pointer is converted to a char* and used for comparison, which causes the crash.

One potential fix is:

-(NSString *)decodedFilename {
if (self.filename) {
return MailCoreDecodeMIMEPhrase((char *)[self.filename UTF8String]);
}
else {
return nil;
}
}

You could also be smarter about it and return a generic filetype with the correct ending based on the mime type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant