summaryrefslogtreecommitdiffhomepage
path: root/lib.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-01-20 19:59:46 +0100
committerJo-Philipp Wich <jo@mein.io>2022-01-20 19:59:46 +0100
commit01132db357544327e4934c2b1a5255cd8b2a7c1e (patch)
treebbff99af205ce17c443485fb81433d9834785218 /lib.c
parent03b6a8efc1834a4114f0d11e1a7cecff3242b305 (diff)
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 <jo@mein.io>
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c3
1 files changed, 2 insertions, 1 deletions
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;
}
}