From: Thomas Weißschuh Date: Tue, 26 Dec 2023 10:20:03 +0000 (+0100) Subject: readprofile: use xasprintf to build string X-Git-Tag: v2.40-rc1~84^2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6657ea47f9421481b835994ffbc78722cc742d2d;p=thirdparty%2Futil-linux.git readprofile: use xasprintf to build string Signed-off-by: Thomas Weißschuh --- diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c index 3abf6c7279..6e6a68b0ca 100644 --- a/sys-utils/readprofile.c +++ b/sys-utils/readprofile.c @@ -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; }