1
0
Fork 0

mark stream as bad if the identifier was not read completely

This commit is contained in:
Kevin Matz 2023-05-20 13:43:28 -04:00
parent 6b82f0eda4
commit 26645b5c4d
1 changed files with 1 additions and 1 deletions

View File

@ -953,7 +953,7 @@ void Packet::iStream(std::shared_ptr<bufferstream> stream)
// Field #
stream->read(identifier, sizeof(identifier)); // 1
if (stream->gcount() != sizeof(identifier))
return stream->setstate(std::ios_base::failbit);
return stream->setstate(std::ios_base::badbit);
if (memcmp(identifier, PACKET_IDENTIFIER, sizeof(identifier))) // memcmp returns 0 if matched
return stream->setstate(std::ios_base::failbit);