Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178248836
D62328.1796332449.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D62328.1796332449.diff
View Options
diff --git a/lib/libc/stdio/vfwscanf.c b/lib/libc/stdio/vfwscanf.c
--- a/lib/libc/stdio/vfwscanf.c
+++ b/lib/libc/stdio/vfwscanf.c
@@ -675,12 +675,13 @@
break;
case '[':
- ccl.start = fmt;
if (*fmt == '^') {
ccl.compl = 1;
fmt++;
- } else
+ } else {
ccl.compl = 0;
+ }
+ ccl.start = fmt;
if (*fmt == ']')
fmt++;
while (*fmt != '\0' && *fmt != ']')
diff --git a/lib/libc/tests/stdio/sscanf_test.c b/lib/libc/tests/stdio/sscanf_test.c
--- a/lib/libc/tests/stdio/sscanf_test.c
+++ b/lib/libc/tests/stdio/sscanf_test.c
@@ -393,6 +393,11 @@
*s = '\0';
ATF_CHECK_EQ(2, sscanf("3.1415pi", "%[0-9]%[.]%[0-9\0%[a-z]", s, s, s, s));
ATF_CHECK_STREQ(".", s);
+
+ /* The initial ^ of a negated set is not part of the set */
+ *s = '\0';
+ ATF_CHECK_EQ(1, sscanf("^a", "%[^a]", s));
+ ATF_CHECK_STREQ("^", s);
}
ATF_TP_ADD_TCS(tp)
diff --git a/lib/libc/tests/stdio/swscanf_test.c b/lib/libc/tests/stdio/swscanf_test.c
--- a/lib/libc/tests/stdio/swscanf_test.c
+++ b/lib/libc/tests/stdio/swscanf_test.c
@@ -396,6 +396,11 @@
*s = L'\0';
ATF_CHECK_EQ(2, swscanf(L"3.1415pi", L"%l[0-9]%l[.]%l[0-9\0%l[a-z]", s, s, s, s));
ATF_CHECK_WCSEQ(L".", s);
+
+ /* The initial ^ of a negated set is not part of the set */
+ *s = '\0';
+ ATF_CHECK_EQ(1, swscanf(L"^a", L"%[^a]", s));
+ ATF_CHECK_WCSEQ(L"^", s);
}
ATF_TP_ADD_TCS(tp)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 3, 9:14 PM (18 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42191999
Default Alt Text
D62328.1796332449.diff (1 KB)
Attached To
Mode
D62328: stdio: Fix negated wchar scansets
Attached
Detach File
Event Timeline