mirror of
https://github.com/janet-lang/janet
synced 2025-08-27 16:12:26 +00:00
Merge pull request #1601 from edsrzf/limit-buffer-read
Use strnlen when checking for null byte
This commit is contained in:
commit
f181948aa9
@ -1066,7 +1066,7 @@ void janet_buffer_format(
|
|||||||
if (form[2] == '\0')
|
if (form[2] == '\0')
|
||||||
janet_buffer_push_bytes(b, s, l);
|
janet_buffer_push_bytes(b, s, l);
|
||||||
else {
|
else {
|
||||||
if (l != (int32_t) strlen((const char *) s))
|
if (l != (int32_t) strnlen((const char *) s, l))
|
||||||
janet_panic("string contains zeros");
|
janet_panic("string contains zeros");
|
||||||
if (!strchr(form, '.') && l >= 100) {
|
if (!strchr(form, '.') && l >= 100) {
|
||||||
janet_panic("no precision and string is too long to be formatted");
|
janet_panic("no precision and string is too long to be formatted");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user