[PATCH v2 1/2] msvcrt: Fix scanf with leading dash in scanset.

Will Mainio will.mainio at fastmail.com
Fri Oct 30 07:33:22 CDT 2020


Signed-off-by: Will Mainio <will.mainio at fastmail.com>
---
 dlls/msvcrt/scanf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/msvcrt/scanf.h b/dlls/msvcrt/scanf.h
index 3b4686c1107..b0254ef9224 100644
--- a/dlls/msvcrt/scanf.h
+++ b/dlls/msvcrt/scanf.h
@@ -639,7 +639,7 @@ _FUNCTION_ {
                     while(*format && (*format != ']')) {
 			/* According to msdn:
 			 * "Note that %[a-z] and %[z-a] are interpreted as equivalent to %[abcde...z]." */
-			if((*format == '-') && (*(format + 1) != ']')) {
+			if((*format == '-') && (*(format - 1) != '[') && (*(format + 1) != ']')) {
 			    if ((*(format - 1)) < *(format + 1))
 				RtlSetBits(&bitMask, *(format - 1) +1 , *(format + 1) - *(format - 1));
 			    else
-- 
2.28.0




More information about the wine-devel mailing list