From: Thomas Weißschuh Date: Tue, 26 Dec 2023 10:21:10 +0000 (+0100) Subject: hexdump: use xasprintf to build string X-Git-Tag: v2.40-rc1~84^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=41e002220a5ec7dc67876c72eeb12754343188bd;p=thirdparty%2Futil-linux.git hexdump: use xasprintf to build string Signed-off-by: Thomas Weißschuh --- diff --git a/text-utils/hexdump-parse.c b/text-utils/hexdump-parse.c index 272bb24e3c..23fffc8692 100644 --- a/text-utils/hexdump-parse.c +++ b/text-utils/hexdump-parse.c @@ -427,9 +427,7 @@ isint: cs[3] = '\0'; */ savech = *p2; p1[0] = '\0'; - pr->fmt = xmalloc(strlen(fmtp) + strlen(cs) + 1); - strcpy(pr->fmt, fmtp); - strcat(pr->fmt, cs); + xasprintf(&pr->fmt, "%s%s", fmtp, cs); *p2 = savech; pr->cchar = pr->fmt + (p1 - fmtp); fmtp = p2;