Skip to content

Commit f181948

Browse files
authored
Merge pull request #1601 from edsrzf/limit-buffer-read
Use strnlen when checking for null byte
2 parents 27f01e2 + bbe6b90 commit f181948

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/pp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ void janet_buffer_format(
10661066
if (form[2] == '\0')
10671067
janet_buffer_push_bytes(b, s, l);
10681068
else {
1069-
if (l != (int32_t) strlen((const char *) s))
1069+
if (l != (int32_t) strnlen((const char *) s, l))
10701070
janet_panic("string contains zeros");
10711071
if (!strchr(form, '.') && l >= 100) {
10721072
janet_panic("no precision and string is too long to be formatted");

0 commit comments

Comments
 (0)