1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-03 17:47:28 +03:00

Merge pull request #30515 from poettering/dnslabelmax

extend most DNS label buffers by one
This commit is contained in:
Lennart Poettering 2023-12-18 15:12:27 +01:00 committed by GitHub
commit f5fcf851b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 14 deletions

View File

@ -1951,7 +1951,7 @@ found_closest_encloser:
}
static int dnssec_nsec_wildcard_equal(DnsResourceRecord *rr, const char *name) {
char label[DNS_LABEL_MAX];
char label[DNS_LABEL_MAX+1];
const char *n;
int r;

View File

@ -552,7 +552,7 @@ int dns_packet_append_name(
while (!dns_name_is_root(name)) {
const char *z = name;
char label[DNS_LABEL_MAX];
char label[DNS_LABEL_MAX+1];
size_t n = 0;
if (allow_compression)

View File

@ -388,7 +388,7 @@ static char* fallback_hostname(void) {
static int make_fallback_hostnames(char **full_hostname, char **llmnr_hostname, char **mdns_hostname) {
_cleanup_free_ char *h = NULL, *n = NULL, *m = NULL;
char label[DNS_LABEL_MAX];
char label[DNS_LABEL_MAX+1];
const char *p;
int r;

View File

@ -410,7 +410,7 @@ int dns_name_concat(const char *a, const char *b, DNSLabelFlags flags, char **_r
goto finish;
for (;;) {
char label[DNS_LABEL_MAX];
char label[DNS_LABEL_MAX+1];
r = dns_label_unescape(&p, label, sizeof label, flags);
if (r < 0)
@ -507,7 +507,7 @@ int dns_name_compare_func(const char *a, const char *b) {
y = b + strlen(b);
for (;;) {
char la[DNS_LABEL_MAX], lb[DNS_LABEL_MAX];
char la[DNS_LABEL_MAX+1], lb[DNS_LABEL_MAX+1];
if (x == NULL && y == NULL)
return 0;
@ -543,7 +543,7 @@ int dns_name_equal(const char *x, const char *y) {
assert(y);
for (;;) {
char la[DNS_LABEL_MAX], lb[DNS_LABEL_MAX];
char la[DNS_LABEL_MAX+1], lb[DNS_LABEL_MAX+1];
r = dns_label_unescape(&x, la, sizeof la, 0);
if (r < 0)
@ -574,7 +574,7 @@ int dns_name_endswith(const char *name, const char *suffix) {
s = suffix;
for (;;) {
char ln[DNS_LABEL_MAX], ls[DNS_LABEL_MAX];
char ln[DNS_LABEL_MAX+1], ls[DNS_LABEL_MAX+1];
r = dns_label_unescape(&n, ln, sizeof ln, 0);
if (r < 0)
@ -612,7 +612,7 @@ int dns_name_startswith(const char *name, const char *prefix) {
p = prefix;
for (;;) {
char ln[DNS_LABEL_MAX], lp[DNS_LABEL_MAX];
char ln[DNS_LABEL_MAX+1], lp[DNS_LABEL_MAX+1];
r = dns_label_unescape(&p, lp, sizeof lp, 0);
if (r < 0)
@ -644,7 +644,7 @@ int dns_name_change_suffix(const char *name, const char *old_suffix, const char
s = old_suffix;
for (;;) {
char ln[DNS_LABEL_MAX], ls[DNS_LABEL_MAX];
char ln[DNS_LABEL_MAX+1], ls[DNS_LABEL_MAX+1];
if (!saved_before)
saved_before = n;
@ -929,7 +929,7 @@ bool dns_srv_type_is_valid(const char *name) {
return false;
for (;;) {
char label[DNS_LABEL_MAX];
char label[DNS_LABEL_MAX+1];
/* This more or less implements RFC 6335, Section 5.1 */
@ -1227,7 +1227,7 @@ int dns_name_common_suffix(const char *a, const char *b, const char **ret) {
return m;
for (;;) {
char la[DNS_LABEL_MAX], lb[DNS_LABEL_MAX];
char la[DNS_LABEL_MAX+1], lb[DNS_LABEL_MAX+1];
const char *x, *y;
if (k >= n || k >= m) {
@ -1328,7 +1328,7 @@ int dns_name_apply_idna(const char *name, char **ret) {
assert(ret);
for (;;) {
char label[DNS_LABEL_MAX];
char label[DNS_LABEL_MAX+1];
r = dns_label_unescape(&name, label, sizeof label, 0);
if (r < 0)

View File

@ -78,8 +78,7 @@ int specifier_printf(const char *text, size_t max_length, const Specifier table[
if (!GREEDY_REALLOC(result, j + k + l + 1))
return -ENOMEM;
memcpy(result + j, w, k);
t = result + j + k;
t = mempcpy(result + j, w, k);
} else if (strchr(POSSIBLE_SPECIFIERS, *f))
/* Oops, an unknown specifier. */
return -EBADSLT;