summaryrefslogtreecommitdiffstats
path: root/text-utils/conv.c
diff options
context:
space:
mode:
authorOndrej Oprala2013-09-23 15:39:27 +0200
committerKarel Zak2013-11-08 12:54:53 +0100
commit53a9a9939e40162e200ca2910b3ac0bcaf5ecb15 (patch)
tree8146fe27a6710bb52ec5ffe6774aed22e6318a52 /text-utils/conv.c
parenthexdump: delete redundant typecasts (diff)
downloadkernel-qcow2-util-linux-53a9a9939e40162e200ca2910b3ac0bcaf5ecb15.tar.gz
kernel-qcow2-util-linux-53a9a9939e40162e200ca2910b3ac0bcaf5ecb15.tar.xz
kernel-qcow2-util-linux-53a9a9939e40162e200ca2910b3ac0bcaf5ecb15.zip
hexdump: use xasprintf in conv_c()
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Diffstat (limited to 'text-utils/conv.c')
-rw-r--r--text-utils/conv.c6
1 files changed, 4 insertions, 2 deletions
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 <ctype.h>
#include <sys/types.h>
#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