Commit b62854b1eac86d9be224f24a79d5505e0049bc40

Authored by Wiebe Cazemier
1 parent e2ea3ea8

Make atEnd() more robust

Showing 1 changed file with 2 additions and 1 deletions
mqttpacket.cpp
@@ -1258,7 +1258,8 @@ void MqttPacket::calculateRemainingLength() @@ -1258,7 +1258,8 @@ void MqttPacket::calculateRemainingLength()
1258 1258
1259 bool MqttPacket::atEnd() const 1259 bool MqttPacket::atEnd() const
1260 { 1260 {
1261 - return pos == bites.size(); 1261 + assert(pos <= bites.size());
  1262 + return pos >= bites.size();
1262 } 1263 }
1263 1264
1264 void MqttPacket::setPacketId(uint16_t packet_id) 1265 void MqttPacket::setPacketId(uint16_t packet_id)