mark stream as bad if the identifier was not read completely
This commit is contained in:
parent
6b82f0eda4
commit
26645b5c4d
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue