From 53a9a9939e40162e200ca2910b3ac0bcaf5ecb15 Mon Sep 17 00:00:00 2001 From: Ondrej Oprala Date: Mon, 23 Sep 2013 15:39:27 +0200 Subject: hexdump: use xasprintf in conv_c() Signed-off-by: Ondrej Oprala --- text-utils/conv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'text-utils/conv.c') diff --git a/text-utils/conv.c b/text-utils/conv.c index 4f7a248f2..abb62d06d 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 -- cgit v1.2.3-55-g7522