summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/unicode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libbb/unicode.c b/libbb/unicode.c
index 9c4da50..d378175 100644
--- a/libbb/unicode.c
+++ b/libbb/unicode.c
@@ -1121,6 +1121,8 @@ static char* FAST_FUNC unicode_conv_to_printable2(uni_stat_t *stats, const char
dst[dst_len++] = ' ';
}
}
+ if (!dst) /* for example, if input was "" */
+ dst = xzalloc(1);
dst[dst_len] = '\0';
if (stats) {
stats->byte_count = dst_len;