From: Ondrej Oprala Date: Mon, 23 Sep 2013 13:39:27 +0000 (+0200) Subject: hexdump: use xasprintf in conv_c() X-Git-Tag: v2.25-rc1~754 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53a9a9939e40162e200ca2910b3ac0bcaf5ecb15;p=thirdparty%2Futil-linux.git hexdump: use xasprintf in conv_c() Signed-off-by: Ondrej Oprala --- diff --git a/text-utils/conv.c b/text-utils/conv.c index 4f7a248f29..abb62d06de 100644 --- a/text-utils/conv.c +++ b/text-utils/conv.c @@ -35,11 +35,12 @@ #include #include #include "hexdump.h" +#include "xalloc.h" void conv_c(PR *pr, u_char *p) { - char buf[10]; + char *buf = NULL; char const *str; switch(*p) { @@ -75,11 +76,12 @@ conv_c(PR *pr, u_char *p) *pr->cchar = 'c'; printf(pr->fmt, *p); } else { - sprintf(buf, "%03o", (int)*p); + xasprintf(&buf, "%03o", (int)*p); str = buf; strpr: *pr->cchar = 's'; printf(pr->fmt, str); } + free(buf); } void