diff --git a/mozilla/mailnews/compose/src/nsMsgAttachment.cpp b/mozilla/mailnews/compose/src/nsMsgAttachment.cpp index fece96abf37..81b3e9103f4 100644 --- a/mozilla/mailnews/compose/src/nsMsgAttachment.cpp +++ b/mozilla/mailnews/compose/src/nsMsgAttachment.cpp @@ -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; diff --git a/mozilla/mailnews/mime/src/mimemult.cpp b/mozilla/mailnews/mime/src/mimemult.cpp index 4d61cbee188..3b7b2d13b55 100644 --- a/mozilla/mailnews/mime/src/mimemult.cpp +++ b/mozilla/mailnews/mime/src/mimemult.cpp @@ -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 diff --git a/mozilla/uriloader/exthandler/mac/nsInternetConfigService.cpp b/mozilla/uriloader/exthandler/mac/nsInternetConfigService.cpp index 68905281182..06daa9f63ed 100644 --- a/mozilla/uriloader/exthandler/mac/nsInternetConfigService.cpp +++ b/mozilla/uriloader/exthandler/mac/nsInternetConfigService.cpp @@ -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]); diff --git a/mozilla/xpfe/appshell/src/nsInternetConfigService.cpp b/mozilla/xpfe/appshell/src/nsInternetConfigService.cpp index 68905281182..06daa9f63ed 100644 --- a/mozilla/xpfe/appshell/src/nsInternetConfigService.cpp +++ b/mozilla/xpfe/appshell/src/nsInternetConfigService.cpp @@ -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]);