Module: wine Branch: master Commit: c38102b9b49c2f63e9ff7369f612b999dec609ca URL: https://source.winehq.org/git/wine.git/?a=commit;h=c38102b9b49c2f63e9ff7369f...
Author: Will Mainio will.mainio@fastmail.com Date: Mon Nov 2 16:00:07 2020 +0100
msvcrt: Fix scanf with dashes in scanset.
Signed-off-by: Will Mainio will.mainio@fastmail.com Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/scanf.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcrt/scanf.h b/dlls/msvcrt/scanf.h index 3b4686c1107..e1a194e39fa 100644 --- a/dlls/msvcrt/scanf.h +++ b/dlls/msvcrt/scanf.h @@ -639,12 +639,12 @@ _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 - 1)) < *(format + 1)) - RtlSetBits(&bitMask, *(format - 1) +1 , *(format + 1) - *(format - 1)); - else - RtlSetBits(&bitMask, *(format + 1) , *(format - 1) - *(format + 1)); - format++; + if(format[1] == '-' && format[2] && format[2] != ']') { + if (format[0] < format[2]) + RtlSetBits(&bitMask, format[0], format[2] - format[0] + 1); + else + RtlSetBits(&bitMask, format[2], format[0] - format[2] + 1); + format += 2; } else RtlSetBits(&bitMask, *format, 1); format++;