Browse Source

Added control message size check when reading it

Paul-Louis Ageneau 4 years ago
parent
commit
cba864507f
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/datachannel.cpp

+ 2 - 0
src/datachannel.cpp

@@ -218,6 +218,8 @@ void DataChannel::incoming(message_ptr message) {
 
 	switch (message->type) {
 	case Message::Control: {
+		if (message->size() == 0)
+			break; // Ignore
 		auto raw = reinterpret_cast<const uint8_t *>(message->data());
 		switch (raw[0]) {
 		case MESSAGE_OPEN: