Skip to content

Commit d9ed7a7

Browse files
authored
Merge pull request #1106 from CosmicToast/1105
handle null-byte case in scanformat (fixes #1105)
2 parents bef5bd7 + 0902a5a commit d9ed7a7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/core/pp.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,8 @@ static const char *scanformat(
809809
*(form++) = '%';
810810
const char *p2 = strfrmt;
811811
while (p2 <= p) {
812-
if (strchr(FMT_REPLACE_INTTYPES, *p2) != NULL) {
812+
char *loc = strchr(FMT_REPLACE_INTTYPES, *p2);
813+
if (loc != NULL && *loc != '\0') {
813814
const char *mapping = get_fmt_mapping(*p2++);
814815
size_t len = strlen(mapping);
815816
strcpy(form, mapping);

0 commit comments

Comments
 (0)