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.

git-svn-id: svn://10.0.0.236/trunk@103738 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%netscape.com
2001-09-25 22:21:14 +00:00
parent 3d9f84418c
commit dd310a2b40

View File

@@ -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)