Skip to content

Commit

Permalink
parse msgtype only fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tschiemer committed Jul 5, 2020
1 parent aa2ef3e commit 50468be
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion minimr.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,19 @@ int32_t minimr_parse_msg(

// ignore messages that are not long enough to even have a complete header
if (msglen < MINIMR_DNS_HDR_SIZE){
return MINIMR_IGNORE;
return MINIMR_OK;
}

struct minimr_dns_hdr hdr;

// read header info
minimr_dns_hdr_read(&hdr, msg);

// if asked for specific type but other at hand, abort
if ((msgtype == minimr_msgtype_query && (hdr.flags[0] & MINIMR_DNS_HDR1_QR) == MINIMR_DNS_HDR1_QR_REPLY )
|| (msgtype == minimr_msgtype_response && (hdr.flags[0] & MINIMR_DNS_HDR1_QR) == MINIMR_DNS_HDR1_QR_REPLY )){
return MINIMR_OK;
}

uint16_t pos = MINIMR_DNS_HDR_SIZE;

Expand Down

0 comments on commit 50468be

Please sign in to comment.