summaryrefslogtreecommitdiffstats
path: root/src/dns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dns.c')
-rw-r--r--src/dns.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dns.c b/src/dns.c
index e420ee1..c3be024 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -131,8 +131,8 @@ uint8_t *dns_packet_append_name_compressed(struct dns_packet *p, const char *nam
}
int dns_packet_check_valid(struct dns_packet *p) {
- assert(p);
uint16_t flags;
+ assert(p);
if (p->size < 12)
return -1;
@@ -278,7 +278,10 @@ int dns_packet_consume_bytes(struct dns_packet *p, void *ret_data, size_t l) {
}
int dns_packet_consume_seek(struct dns_packet *p, size_t length) {
- assert(p && length > 0);
+ assert(p && length >= 0);
+
+ if (!length)
+ return 0;
if (p->rindex + length > p->size)
return -1;