]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved-util: NUL-terminate host label
authorRonan Pigott <ronan@rjp.ie>
Sat, 16 Dec 2023 19:45:07 +0000 (12:45 -0700)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 17 Dec 2023 07:56:43 +0000 (16:56 +0900)
In case the host has a 63-byte hostname, we must have enough space for a
NUL terminator as well.

src/resolve/resolved-util.c

index 00abada426ccebfc1c26bd1c3af4054035dce029..adcd35d6bee8483b781fbef9fe83fc834de574f1 100644 (file)
@@ -14,7 +14,7 @@ int resolve_system_hostname(char **full_hostname, char **first_label) {
 #elif HAVE_LIBIDN
         int k;
 #endif
-        char label[DNS_LABEL_MAX];
+        char label[DNS_LABEL_MAX+1];
         const char *p, *decoded;
         int r;