зеркало из https://github.com/mozilla/pjs.git
Changed strcpy to strncpy to protect the buffer,
bug 145370, r=ducarroz, sr=bienvenu.
This commit is contained in:
Родитель
c0da074e38
Коммит
0f577ea944
|
@ -776,7 +776,8 @@ mime_generate_attachment_headers (const char *type, const char *encoding,
|
|||
{
|
||||
|
||||
char charset_label[65] = ""; // Content-Type: charset
|
||||
PL_strcpy(charset_label, charset);
|
||||
PL_strncpy(charset_label, charset, sizeof(charset_label)-1);
|
||||
charset_label[sizeof(charset_label)-1] = '\0';
|
||||
|
||||
/* If the characters are all 7bit, then it's better (and true) to
|
||||
claim the charset to be US- rather than Latin1. Should we
|
||||
|
|
|
@ -63,7 +63,8 @@ nsMsgSendPart::nsMsgSendPart(nsIMsgSend* state, const char *part_charset)
|
|||
{
|
||||
m_state = nsnull;
|
||||
|
||||
PL_strcpy(m_charset_name, part_charset ? part_charset : "us-ascii");
|
||||
PL_strncpy(m_charset_name, (part_charset ? part_charset : "us-ascii"), sizeof(m_charset_name)-1);
|
||||
m_charset_name[sizeof(m_charset_name)-1] = '\0';
|
||||
m_children = nsnull;
|
||||
m_numchildren = 0;
|
||||
|
||||
|
|
|
@ -310,7 +310,8 @@ PRInt32 generate_encodedwords(char *pUTF8, const char *charset, char method, cha
|
|||
}
|
||||
const PRUnichar *charsetName;
|
||||
charsetAtom->GetUnicode(&charsetName);
|
||||
strcpy(_charset, NS_ConvertUCS2toUTF8(charsetName).get());
|
||||
strncpy(_charset, NS_ConvertUCS2toUTF8(charsetName).get(), sizeof(_charset)-1);
|
||||
_charset[sizeof(_charset)-1] = '\0';
|
||||
if (_charset[0])
|
||||
charset = _charset;
|
||||
}
|
||||
|
@ -1072,7 +1073,8 @@ char *intl_decode_mime_part2_str(const char *header,
|
|||
|
||||
// Override charset if requested. Never override labeled UTF-8.
|
||||
if (override_charset && 0 != nsCRT::strcasecmp(charset, "UTF-8")) {
|
||||
PL_strcpy(charset, default_charset);
|
||||
PL_strncpy(charset, default_charset, sizeof(charset)-1);
|
||||
charset[sizeof(charset)-1] = '\0';
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(ConvertToUnicode(charset, decoded_text, tempUnicodeString))) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче