bug 402150 prevent crash @nsDocument::RetrieveRelevantHeaders, r=wtc, r/sr=jst, a=beltzner

This commit is contained in:
dveditz@cruzio.com 2007-11-09 14:54:35 -08:00
Родитель 406b6dc659
Коммит 7f26e0225d
1 изменённых файлов: 6 добавлений и 4 удалений

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

@ -46,6 +46,7 @@
*/
#include "plstr.h"
#include "prprf.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
@ -5332,10 +5333,11 @@ nsDocument::RetrieveRelevantHeaders(nsIChannel *aChannel)
PRExplodedTime prtime;
PR_ExplodeTime(modDate, PR_LocalTimeParameters, &prtime);
// "MM/DD/YYYY hh:mm:ss"
char formatedTime[20];
if (sprintf(formatedTime, "%02d/%02d/%04d %02d:%02d:%02d",
prtime.tm_month + 1, prtime.tm_mday, prtime.tm_year,
prtime.tm_hour , prtime.tm_min, prtime.tm_sec)) {
char formatedTime[24];
if (PR_snprintf(formatedTime, sizeof(formatedTime),
"%02ld/%02ld/%04hd %02ld:%02ld:%02ld",
prtime.tm_month + 1, prtime.tm_mday, prtime.tm_year,
prtime.tm_hour , prtime.tm_min, prtime.tm_sec)) {
CopyASCIItoUTF16(nsDependentCString(formatedTime), mLastModified);
}
}