From 01132db357544327e4934c2b1a5255cd8b2a7c1e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 20 Jan 2022 19:59:46 +0100 Subject: lib: fix %J string formats with precision specifier Previous refactoring of the code led to an invalid internal format pettern being used to output the formatted JSON data. Fixes: 9041e24 ("lib: fix uninitialized memory access on handling %J string formats") Signed-off-by: Jo-Philipp Wich --- lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index 0e77b23..366b958 100644 --- a/lib.c +++ b/lib.c @@ -1324,8 +1324,9 @@ uc_printf_common(uc_vm_t *vm, size_t nargs, uc_stringbuf_t *buf) if (sfmt[i] == '.') { for (pad_size = 0, i++; sfmt + i < fp && isdigit(sfmt[i]); i++) pad_size = pad_size * 10 + (sfmt[i] - '0'); + pad_size++; - fp = &sfmt[i-1]; + fp = strchr(sfmt, '.'); break; } } -- cgit v1.2.3