Skip to content

Commit

Permalink
Remove possibility of crash when giving a malformed CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
themaks committed Nov 15, 2022
1 parent fe4ab63 commit f760cd2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion EDRSandblast/Utils/NtoskrnlOffsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ void LoadNtoskrnlOffsetsFromFile(TCHAR* ntoskrnlOffsetFilename) {
return;
}

TCHAR lineNtoskrnlVersion[256];
TCHAR lineNtoskrnlVersion[2048];
TCHAR line[2048];
while (_fgetts(line, _countof(line), offsetFileStream)) {
if (_tcsncmp(line, TEXT("ntoskrnl"), _countof(TEXT("ntoskrnl")) - 1)) {
_putts_or_not(TEXT("[-] CSV file format is unexpected!\n"));
break;
}
TCHAR* dupline = _tcsdup(line);
TCHAR* tmpBuffer = NULL;
_tcscpy_s(lineNtoskrnlVersion, _countof(lineNtoskrnlVersion), _tcstok_s(dupline, TEXT(","), &tmpBuffer));
Expand Down

0 comments on commit f760cd2

Please sign in to comment.