mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-08 09:23:17 +00: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);
|
readlong(packet, &data, &ttl);
|
||||||
readshort(packet, &data, &rlen);
|
readshort(packet, &data, &rlen);
|
||||||
rv = MIN(rlen, sizeof(rdata));
|
rv = MIN(rlen, sizeof(rdata));
|
||||||
readdata(packet, &data, rdata, rv);
|
rv = readdata(packet, &data, rdata, rv);
|
||||||
|
|
||||||
if(type == T_NULL && rv > 2) {
|
if(type == T_NULL && rv > 2) {
|
||||||
rv = MIN(rv, buflen);
|
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, &type);
|
||||||
readshort(packet, &data, &class);
|
readshort(packet, &data, &class);
|
||||||
|
|
||||||
|
if(type != T_NULL) {
|
||||||
|
rv = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(q->name, name, 257);
|
strncpy(q->name, name, 257);
|
||||||
q->type = type;
|
q->type = type;
|
||||||
q->id = id;
|
q->id = id;
|
||||||
|
|
Loading…
Reference in a new issue