TXT records should have at least one character, so enforce this.
Before
0f84a72 parser SIGSEGV'd on ->txt.strings being NULL, but
even if this is fixed we should reject invalid TXT records.
case DNS_TYPE_TXT: {
char *s;
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)
while (p->rindex < offset + rdlength) {
r = dns_packet_read_string(p, &s, NULL);
if (r < 0)