/* Jumps are limited to a "prior occurence" (RFC-1035 4.1.4) */
jump_barrier = ptr;
p->rindex = ptr;
- } else
+ } else {
+ r = -EBADMSG;
goto fail;
+ }
}
if (!GREEDY_REALLOC(ret, allocated, n + 1)) {
case DNS_TYPE_TXT: {
char *s;
+ /* RFC 1035 says that TXT must be at least one
+ string. Reject empty records. */
+ if (!rdlength) {
+ r = -EBADMSG;
+ goto fail;
+ }
+
while (p->rindex < offset + rdlength) {
r = dns_packet_read_string(p, &s, NULL);
if (r < 0)