From faf2ad1dc5a1a3fb131559c26675cecdd20b74a8 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 27 May 2019 22:52:57 -0700 Subject: libbb: Drop simple_itoa() Hush is the only one user of simple_itoa() and the code there can be re-implemented using snprintf(). Change the code to get rid of simple_itoa(). Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- common/hush.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'common/hush.c') diff --git a/common/hush.c b/common/hush.c index dab9b04081..68c3eccdfc 100644 --- a/common/hush.c +++ b/common/hush.c @@ -402,7 +402,12 @@ static void b_free(o_string *o) static int b_adduint(o_string *o, unsigned int i) { int r; - char *p = simple_itoa(i); + /* 21 digits plus null terminator, good for 64-bit or smaller + * ints */ + char number[22]; + char *p = number; + + snprintf(number, sizeof(number), "%u", i); /* no escape checking necessary */ do { -- cgit v1.2.3