From bbe6b9033126887fc41dd0df9d42a93e66ef65c6 Mon Sep 17 00:00:00 2001 From: Evan Shaw Date: Sat, 14 Jun 2025 22:29:30 +1200 Subject: [PATCH] Use strnlen when checking for null byte --- src/core/pp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/pp.c b/src/core/pp.c index 0c9e81ce..618f7515 100644 --- a/src/core/pp.c +++ b/src/core/pp.c @@ -1066,7 +1066,7 @@ void janet_buffer_format( if (form[2] == '\0') janet_buffer_push_bytes(b, s, l); else { - if (l != (int32_t) strlen((const char *) s)) + if (l != (int32_t) strnlen((const char *) s, l)) janet_panic("string contains zeros"); if (!strchr(form, '.') && l >= 100) { janet_panic("no precision and string is too long to be formatted");