]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hexdump: use xasprintf to build string
authorThomas Weißschuh <thomas@t-8ch.de>
Tue, 26 Dec 2023 10:21:10 +0000 (11:21 +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>
text-utils/hexdump-parse.c

index 272bb24e3c4a0066de5c8a72e776f56ee3b5fc79..23fffc86921d931b47da9a7bf36eca72ec398db7 100644 (file)
@@ -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;