소스 검색

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.
Image 4 년 전
부모
커밋
e5876f9a10
4개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      EQ2/source/common/EQPacket.cpp
  2. BIN
      server/EQ2Login__Debug.exe
  3. BIN
      server/EQ2World__Debug.exe
  4. BIN
      server/EQ2World__Debug_x64.exe

+ 6 - 1
EQ2/source/common/EQPacket.cpp

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

BIN
server/EQ2Login__Debug.exe


BIN
server/EQ2World__Debug.exe


BIN
server/EQ2World__Debug_x64.exe