Skip to content

Commit 8928c85

Browse files
committed
Fix issue from review
1 parent ebce242 commit 8928c85

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/mqtt_sn_packet.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,9 @@ int SN_Decode_Publish(byte *rx_buf, int rx_buf_len, SN_Publish *publish)
11631163

11641164
/* Decode payload: use pointer difference to account for both short (7)
11651165
* and extended-length (9) header formats */
1166+
if (total_len < (word16)(rx_payload - rx_buf)) {
1167+
return MQTT_TRACE_ERROR(MQTT_CODE_ERROR_MALFORMED_DATA);
1168+
}
11661169
publish->total_len = total_len - (word16)(rx_payload - rx_buf);
11671170
publish->buffer = rx_payload;
11681171
publish->buffer_pos = 0;

0 commit comments

Comments
 (0)