aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-09-03 10:36:51 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-09-03 10:36:51 +0200
commit28d91d754e423fd0df584bbfa9b903eacac21224 (patch)
tree950e0e3d367f07639ab00e96db34d537a2cfc620
parent3060992ec94722b4f8f3711a1884270c81a6e5f5 (diff)
downloadbusybox-w32-28d91d754e423fd0df584bbfa9b903eacac21224.tar.gz
busybox-w32-28d91d754e423fd0df584bbfa9b903eacac21224.tar.bz2
busybox-w32-28d91d754e423fd0df584bbfa9b903eacac21224.zip
libbb: fix potential NULL pointer use
function old new delta unicode_conv_to_printable2 193 216 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/unicode.c2
1 files changed, 2 insertions, 0 deletions
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
1121 dst[dst_len++] = ' '; 1121 dst[dst_len++] = ' ';
1122 } 1122 }
1123 } 1123 }
1124 if (!dst) /* for example, if input was "" */
1125 dst = xzalloc(1);
1124 dst[dst_len] = '\0'; 1126 dst[dst_len] = '\0';
1125 if (stats) { 1127 if (stats) {
1126 stats->byte_count = dst_len; 1128 stats->byte_count = dst_len;