From 297455a90d2f3b2abc8fe8e5f2945e0dd8f0b3a6 Mon Sep 17 00:00:00 2001 From: Hideaki Tai Date: Tue, 20 Oct 2020 19:13:41 +0900 Subject: [PATCH] fixed bug causes buffer overrun --- Artnet.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Artnet.h b/Artnet.h index 9bbcdfb..ca326bd 100644 --- a/Artnet.h +++ b/Artnet.h @@ -275,7 +275,7 @@ namespace arx bool parse() { const size_t size = stream->parsePacket(); - if (size == 0) return false; + if (size <= HEADER_SIZE) return false; uint8_t d[size]; stream->read(d, size); @@ -287,9 +287,9 @@ namespace arx memcpy(packet.data(), d, size); remote_ip = stream->S::remoteIP(); remote_port = (uint16_t)stream->S::remotePort(); - if (callback_all) callback_all(universe15bit(), data(), size); + if (callback_all) callback_all(universe15bit(), data(), size - HEADER_SIZE); for (auto& c : callbacks) - if (universe15bit() == c.first) c.second(data(), size); + if (universe15bit() == c.first) c.second(data(), size - HEADER_SIZE); return true; } }