Skip to content

Commit d8dad47

Browse files
committed
Fix test test_sscanf to be spec-conformant in the treatment of scanf format specifiers. According to the standard, %255c matches exactly 255 characters, while %255s matches up to 255 characters.
1 parent b3af30a commit d8dad47

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tests/core/test_sscanf.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ int main() {
6767
memset(buf4, 0, 100);
6868

6969

70-
int numItems = sscanf("level=4:ref=3", "%255[^:=]=%255[^:]:%255[^=]=%255c",
70+
int numItems = sscanf("level=4:ref=3", "%255[^:=]=%255[^:]:%255[^=]=%c",
7171
buf1, buf2, buf3, buf4);
72-
numItems = 4; // XXX musl libc bug: it returns 3 - but still properly fills all the four buf1-buf4 fields!
7372
printf("%d, %s, %s, %s, %s\n", numItems, buf1, buf2, buf3, buf4);
7473

7574
numItems = sscanf("def|456", "%[a-z]|%[0-9]", buf1, buf2);

0 commit comments

Comments
 (0)