Commit 5a44fc7b authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wbemprox: Fix checking for digit characters.

parent c436080e
...@@ -1694,17 +1694,17 @@ static WCHAR *convert_bios_date( const WCHAR *str ) ...@@ -1694,17 +1694,17 @@ static WCHAR *convert_bios_date( const WCHAR *str )
while (len && iswspace( p[len - 1] )) { len--; } while (len && iswspace( p[len - 1] )) { len--; }
q = p; q = p;
while (len && iswdigit( *q )) { q++; len--; }; while (len && is_digit( *q )) { q++; len--; };
if (q - p != 2 || !len || *q != '/') return NULL; if (q - p != 2 || !len || *q != '/') return NULL;
month = (p[0] - '0') * 10 + p[1] - '0'; month = (p[0] - '0') * 10 + p[1] - '0';
p = ++q; len--; p = ++q; len--;
while (len && iswdigit( *q )) { q++; len--; }; while (len && is_digit( *q )) { q++; len--; };
if (q - p != 2 || !len || *q != '/') return NULL; if (q - p != 2 || !len || *q != '/') return NULL;
day = (p[0] - '0') * 10 + p[1] - '0'; day = (p[0] - '0') * 10 + p[1] - '0';
p = ++q; len--; p = ++q; len--;
while (len && iswdigit( *q )) { q++; len--; }; while (len && is_digit( *q )) { q++; len--; };
if (q - p == 4) year = (p[0] - '0') * 1000 + (p[1] - '0') * 100 + (p[2] - '0') * 10 + p[3] - '0'; if (q - p == 4) year = (p[0] - '0') * 1000 + (p[1] - '0') * 100 + (p[2] - '0') * 10 + p[3] - '0';
else if (q - p == 2) year = 1900 + (p[0] - '0') * 10 + p[1] - '0'; else if (q - p == 2) year = 1900 + (p[0] - '0') * 10 + p[1] - '0';
else return NULL; else return NULL;
......
...@@ -272,6 +272,11 @@ static inline WCHAR *heap_strdupAW( const char *src ) ...@@ -272,6 +272,11 @@ static inline WCHAR *heap_strdupAW( const char *src )
return dst; return dst;
} }
static inline BOOL is_digit(WCHAR c)
{
return '0' <= c && c <= '9';
}
static const WCHAR class_processW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s',0}; static const WCHAR class_processW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s',0};
static const WCHAR class_serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e',0}; static const WCHAR class_serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e',0};
static const WCHAR class_stdregprovW[] = {'S','t','d','R','e','g','P','r','o','v',0}; static const WCHAR class_stdregprovW[] = {'S','t','d','R','e','g','P','r','o','v',0};
......
...@@ -785,7 +785,7 @@ static int get_token( const WCHAR *s, int *token ) ...@@ -785,7 +785,7 @@ static int get_token( const WCHAR *s, int *token )
*token = TK_STRING; *token = TK_STRING;
return i; return i;
case '.': case '.':
if (!iswdigit( s[1] )) if (!is_digit( s[1] ))
{ {
*token = TK_DOT; *token = TK_DOT;
return 1; return 1;
...@@ -794,7 +794,7 @@ static int get_token( const WCHAR *s, int *token ) ...@@ -794,7 +794,7 @@ static int get_token( const WCHAR *s, int *token )
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
*token = TK_INTEGER; *token = TK_INTEGER;
for (i = 1; iswdigit( s[i] ); i++) {} for (i = 1; is_digit( s[i] ); i++) {}
return i; return i;
default: default:
if (!id_char[*s]) break; if (!id_char[*s]) break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment