Crash on localtime struct

Seems localtime struct ptr is not being returned, thus we crash (might be something with my environment), however for now adding a check to stop us from crashing.
This commit is contained in:
Image 2020-02-28 11:09:30 -05:00
parent c4f9c92303
commit e5876f9a10
4 changed files with 6 additions and 1 deletions

View file

@ -138,7 +138,12 @@ void EQPacket::DumpRawHeader(uint16 seq, FILE *to) const
{
if (timestamp.tv_sec) {
char temp[20];
strftime(temp,20,"%F %T",localtime((const time_t *)&timestamp.tv_sec));
struct tm* info = localtime((const time_t*)&timestamp.tv_sec);
if (info)
strftime(temp, 20, "%F %T", info);
else
_snprintf(temp, 20, "[UNKNOWNTIME]");
fprintf(to, "%s.%06lu ",temp,timestamp.tv_usec);
}
if (src_ip) {

Binary file not shown.

Binary file not shown.

Binary file not shown.