mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 19:41:49 +00:00
Fix for bug 111305. Check for null ptr before using it. Don't truncate and initialize a nsString with a length of -1, that cause the whole app to freeze. R=damn, SR=mscott, A=asa
This commit is contained in:
parent
9c4bfebf91
commit
6f175430bb
@ -124,7 +124,7 @@ NS_IMETHODIMP nsMsgAttachment::SetContentType(const char * aContentType)
|
||||
keep only the content type alone. Therefore we need to cleanup it.
|
||||
*/
|
||||
PRInt32 offset = mContentType.FindChar(';');
|
||||
if (offset)
|
||||
if (offset >= 0)
|
||||
mContentType.Truncate(offset);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -456,7 +456,8 @@ MimeMultipart_create_child(MimeObject *obj)
|
||||
{
|
||||
struct mime_stream_data *msd = (struct mime_stream_data *)body->options->stream_closure;
|
||||
if (!body->options->write_html_p && body->content_type && !nsCRT::strcasecmp(body->content_type, APPLICATION_APPLEFILE))
|
||||
msd->channel->SetContentType(APPLICATION_APPLEFILE);
|
||||
if (msd && msd->channel)
|
||||
msd->channel->SetContentType(APPLICATION_APPLEFILE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -295,8 +295,8 @@ nsresult nsInternetConfigService::FillMIMEInfoForICEntry(ICMapEntry& entry, nsIM
|
||||
|
||||
// convert entry.extension which is a Str255
|
||||
// don't forget to remove the '.' in front of the file extension....
|
||||
nsCAutoString temp((char *)&entry.extension[2], (int)entry.extension[0]-1);
|
||||
info->AppendExtension(temp.get());
|
||||
nsCAutoString temp((char *)&entry.extension[2], entry.extension[0] > 0 ? (int)entry.extension[0]-1 : 0);
|
||||
info->AppendExtension(temp.get());
|
||||
info->SetMacType(entry.fileType);
|
||||
info->SetMacCreator(entry.fileCreator);
|
||||
temp.Assign((char *) &entry.entryName[1], entry.entryName[0]);
|
||||
|
@ -295,8 +295,8 @@ nsresult nsInternetConfigService::FillMIMEInfoForICEntry(ICMapEntry& entry, nsIM
|
||||
|
||||
// convert entry.extension which is a Str255
|
||||
// don't forget to remove the '.' in front of the file extension....
|
||||
nsCAutoString temp((char *)&entry.extension[2], (int)entry.extension[0]-1);
|
||||
info->AppendExtension(temp.get());
|
||||
nsCAutoString temp((char *)&entry.extension[2], entry.extension[0] > 0 ? (int)entry.extension[0]-1 : 0);
|
||||
info->AppendExtension(temp.get());
|
||||
info->SetMacType(entry.fileType);
|
||||
info->SetMacCreator(entry.fileCreator);
|
||||
temp.Assign((char *) &entry.entryName[1], entry.entryName[0]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user