Skip to content

Commit abbaca1

Browse files
jukkarnashif
authored andcommitted
net: dns: Check that we do not access data past msg size
This is not possible with valid DNS messages but is possible if we receive malformed DNS packet. Signed-off-by: Jukka Rissanen <[email protected]> Signed-off-by: Flavio Ceolin <[email protected]>
1 parent ffd8a91 commit abbaca1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/net/lib/dns/dns_pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ int dns_unpack_response_query(struct dns_msg_t *dns_msg)
325325

326326
/* 4 bytes more due to qtype and qclass */
327327
offset += DNS_QTYPE_LEN + DNS_QCLASS_LEN;
328-
if (offset > dns_msg->msg_size) {
328+
if (offset >= dns_msg->msg_size) {
329329
return -ENOMEM;
330330
}
331331

0 commit comments

Comments
 (0)