Skip to content

Commit 3b1f3ab

Browse files
Return error for empty files (#2)
1 parent 3eea102 commit 3b1f3ab

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tools/sslogread/src/logSession.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ LogSession::loadUncompressedFile(const std::filesystem::path& filePath, std::str
7878
return false;
7979
}
8080

81+
if (fileSize == 0) {
82+
errorMessage = std::string("the file is empty");
83+
fclose(fileHandle);
84+
return false;
85+
}
86+
8187
// Read the full file
8288
buffer.resize(fileSize);
8389
if (fread((void*)buffer.data(), 1, fileSize, fileHandle) != fileSize) {

0 commit comments

Comments
 (0)