]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
readprofile: use xasprintf to build string
authorThomas Weißschuh <thomas@t-8ch.de>
Tue, 26 Dec 2023 10:20:03 +0000 (11:20 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 31 Dec 2023 12:04:23 +0000 (13:04 +0100)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
sys-utils/readprofile.c

index 3abf6c7279ab935e0ab0d9e413cc4f3095acf896..6e6a68b0ca84c4c56defc440081345f88cdb33b2 100644 (file)
@@ -81,14 +81,10 @@ static char *boot_uname_r_str(void)
 {
        struct utsname uname_info;
        char *s;
-       size_t len;
 
        if (uname(&uname_info))
                return "";
-       len = strlen(BOOT_SYSTEM_MAP) + strlen(uname_info.release) + 1;
-       s = xmalloc(len);
-       strcpy(s, BOOT_SYSTEM_MAP);
-       strcat(s, uname_info.release);
+       xasprintf(&s, "%s%s", BOOT_SYSTEM_MAP, uname_info.release);
        return s;
 }