Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Add bounds check to SU3 fileNameLength (thanks psi).
Browse files Browse the repository at this point in the history
  • Loading branch information
EinMByte committed Feb 7, 2016
1 parent 60e39ba commit d23138d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/Reseed.cpp
Expand Up @@ -213,6 +213,11 @@ int Reseeder::ProcessSU3Stream(
uint16_t fileNameLength, extraFieldLength;
s.read(reinterpret_cast<char *>(&fileNameLength), 2);
fileNameLength = le16toh(fileNameLength);
if (fileNameLength > 255) {
// TODO: avoid overflow with longer filenames
LogPrint(eLogError, "Reseed: SU3 fileNameLength too large: ", int(fileNameLength));
return numFiles;
}
s.read(reinterpret_cast<char *>(&extraFieldLength), 2);
extraFieldLength = le16toh(extraFieldLength);
char localFileName[255];
Expand Down

0 comments on commit d23138d

Please sign in to comment.