1
0
mirror of https://github.com/janet-lang/janet synced 2025-09-18 18:54:12 +00:00

Merge pull request #1106 from CosmicToast/1105

handle null-byte case in scanformat (fixes #1105)
This commit is contained in:
Calvin Rose
2023-04-22 15:25:48 -05:00
committed by GitHub

View File

@@ -809,7 +809,8 @@ static const char *scanformat(
*(form++) = '%';
const char *p2 = strfrmt;
while (p2 <= p) {
if (strchr(FMT_REPLACE_INTTYPES, *p2) != NULL) {
char *loc = strchr(FMT_REPLACE_INTTYPES, *p2);
if (loc != NULL && *loc != '\0') {
const char *mapping = get_fmt_mapping(*p2++);
size_t len = strlen(mapping);
strcpy(form, mapping);