mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
resolve: format zero-length RDATA according to rfc3597
If the RDATA is of zero length, the text representation contains only
the \# token and the single zero representing the length.
(cherry picked from commit 84f788d669
)
This commit is contained in:
parent
d59009dc1d
commit
44984e15bb
@ -1137,12 +1137,15 @@ const char *dns_resource_record_to_string(DnsResourceRecord *rr) {
|
||||
break;
|
||||
|
||||
default:
|
||||
t = hexmem(rr->generic.data, rr->generic.data_size);
|
||||
if (!t)
|
||||
return NULL;
|
||||
|
||||
/* Format as documented in RFC 3597, Section 5 */
|
||||
r = asprintf(&s, "%s \\# %zu %s", k, rr->generic.data_size, t);
|
||||
if (rr->generic.data_size == 0)
|
||||
r = asprintf(&s, "%s \\# 0", k);
|
||||
else {
|
||||
t = hexmem(rr->generic.data, rr->generic.data_size);
|
||||
if (!t)
|
||||
return NULL;
|
||||
r = asprintf(&s, "%s \\# %zu %s", k, rr->generic.data_size, t);
|
||||
}
|
||||
if (r < 0)
|
||||
return NULL;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user