protects against crash when calling smprintf with a null argument. r=me, sr=darin@netscape. patch submitted by risto.kankkunen@iki.fi. bug number 100293.

This commit is contained in:
dougt%netscape.com 2001-09-25 22:21:14 +00:00
Родитель 8c500749fe
Коммит c2bc6ca34d
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -525,11 +525,12 @@ static int cvt_s(SprintfState *ss, const char *s, int width, int prec,
PRUnichar buf[256];
PRUnichar *retbuf = nsnull;
retbuf = UTF8ToUCS2(s, nsCRT::strlen(s), buf, 256);
if (s) {
retbuf = UTF8ToUCS2(s, nsCRT::strlen(s), buf, 256);
if(nsnull == retbuf)
return -1;
if(nsnull == retbuf)
return -1;
}
int ret = cvt_S(ss, retbuf, width, prec, flags);
if(retbuf != buf)