0-length strings are ok

pull/614/head
Brad House 1 year ago
parent b1a514acc1
commit 991bcdba6e
  1. 19
      src/lib/ares__buf.c
  2. 5
      src/lib/ares_dns_parse.c

@ -796,15 +796,16 @@ ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len,
break;
}
/* XXX: Maybe we should scan to make sure it is printable? */
if (bin != NULL) {
status = ares__buf_fetch_bytes_into_buf(buf, binbuf, len);
} else {
status = ares__buf_consume(buf, len);
}
if (status != ARES_SUCCESS) {
break;
if (len) {
/* XXX: Maybe we should scan to make sure it is printable? */
if (bin != NULL) {
status = ares__buf_fetch_bytes_into_buf(buf, binbuf, len);
} else {
status = ares__buf_consume(buf, len);
}
if (status != ARES_SUCCESS) {
break;
}
}
if (!allow_multiple) {

@ -261,9 +261,11 @@ static ares_status_t ares_dns_parse_rr_hinfo(ares__buf_t *buf,
}
/* OS */
return ares_dns_parse_and_set_dns_str(
status = ares_dns_parse_and_set_dns_str(
buf, ares_dns_rr_remaining_len(buf, orig_len, rdlength), ARES_FALSE, rr,
ARES_RR_HINFO_OS);
return status;
}
static ares_status_t ares_dns_parse_rr_mx(ares__buf_t *buf, ares_dns_rr_t *rr,
@ -1085,7 +1087,6 @@ static ares_status_t ares_dns_parse_rr(ares__buf_t *buf, unsigned int flags,
goto done;
}
/* Determine how many bytes were processed */
processed_len = remaining_len - ares__buf_len(buf);

Loading…
Cancel
Save