summaryrefslogtreecommitdiffstats
path: root/text-utils/conv.c
diff options
context:
space:
mode:
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