discard packet if incomplete #13

master
Hideaki Tai 4 years ago
parent 418d08bc7a
commit 19c97fb4d9

@ -249,10 +249,11 @@ namespace arx {
bool parse() { bool parse() {
const size_t size = stream->parsePacket(); const size_t size = stream->parsePacket();
if (size <= HEADER_SIZE) return false; if (size == 0) return false;
uint8_t d[size]; uint8_t d[size];
stream->read(d, size); stream->read(d, size);
if (size <= HEADER_SIZE) return false; // discard packet if incomplete
if (checkID(d)) { if (checkID(d)) {
if (opcode(d) == OPC(OpCode::Dmx)) { if (opcode(d) == OPC(OpCode::Dmx)) {

Loading…
Cancel
Save