summaryrefslogtreecommitdiffstats
path: root/src/shared/dns-domain.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-06-10 22:51:03 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-06-10 23:01:46 +0200
commit9db01ca5b0322bc035e1ccd6b8a0d98a26533b4a (patch)
tree71021bbbfda663ccecc171ac7a13695efe925e9a /src/shared/dns-domain.c
parentMerge pull request #23691 from medhefgo/efi-clang (diff)
downloadsystemd-9db01ca5b0322bc035e1ccd6b8a0d98a26533b4a.tar.xz
systemd-9db01ca5b0322bc035e1ccd6b8a0d98a26533b4a.zip
dns-domain: make each label nul-terminated
dns_label_unescape() does not nul-terminate the buffer if it does not have enough space. Hence, if a lable is enough long, then strjoin() triggers buffer-overflow. Fixes #23705.
Diffstat (limited to 'src/shared/dns-domain.c')
-rw-r--r--src/shared/dns-domain.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index 9acf1cb0d6..97839e7d73 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -1025,7 +1025,7 @@ static bool dns_service_name_label_is_valid(const char *label, size_t n) {
int dns_service_split(const char *joined, char **_name, char **_type, char **_domain) {
_cleanup_free_ char *name = NULL, *type = NULL, *domain = NULL;
const char *p = joined, *q = NULL, *d = NULL;
- char a[DNS_LABEL_MAX], b[DNS_LABEL_MAX], c[DNS_LABEL_MAX];
+ char a[DNS_LABEL_MAX+1], b[DNS_LABEL_MAX+1], c[DNS_LABEL_MAX+1];
int an, bn, cn, r;
unsigned x = 0;