mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-22 16:19:20 +02:00
#5 Add checks on incoming queries
This commit is contained in:
parent
7207d722b4
commit
728919fc9a
|
@ -284,7 +284,7 @@ dns_decode(char *buf, size_t buflen, struct query *q, qr_t qr, char *packet, siz
|
|||
readlong(packet, &data, &ttl);
|
||||
readshort(packet, &data, &rlen);
|
||||
rv = MIN(rlen, sizeof(rdata));
|
||||
readdata(packet, &data, rdata, rv);
|
||||
rv = readdata(packet, &data, rdata, rv);
|
||||
|
||||
if(type == T_NULL && rv > 2) {
|
||||
rv = MIN(rv, buflen);
|
||||
|
@ -302,6 +302,11 @@ dns_decode(char *buf, size_t buflen, struct query *q, qr_t qr, char *packet, siz
|
|||
readshort(packet, &data, &type);
|
||||
readshort(packet, &data, &class);
|
||||
|
||||
if(type != T_NULL) {
|
||||
rv = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
strncpy(q->name, name, 257);
|
||||
q->type = type;
|
||||
q->id = id;
|
||||
|
|
Loading…
Reference in New Issue