From 28d91d754e423fd0df584bbfa9b903eacac21224 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 3 Sep 2018 10:36:51 +0200 Subject: libbb: fix potential NULL pointer use function old new delta unicode_conv_to_printable2 193 216 +23 Signed-off-by: Denys Vlasenko --- libbb/unicode.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libbb/unicode.c') diff --git a/libbb/unicode.c b/libbb/unicode.c index 9c4da50d3..d378175a4 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; -- cgit v1.2.3