mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
[WINESYNC] setupapi: Fix hex digit check in SetupGetBinaryField.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id d580d2c2fdad7f6f00dd12923e475298c019b660 by Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
parent
68a2aa3658
commit
f4792e103a
2 changed files with 13 additions and 4 deletions
|
@ -1966,6 +1966,15 @@ BOOL WINAPI SetupGetIntField( PINFCONTEXT context, DWORD index, PINT result )
|
|||
}
|
||||
|
||||
|
||||
static int xdigit_to_int(WCHAR c)
|
||||
{
|
||||
if ('0' <= c && c <= '9') return c - '0';
|
||||
if ('a' <= c && c <= 'f') return c - 'a' + 10;
|
||||
if ('A' <= c && c <= 'F') return c - 'A' + 10;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetupGetBinaryField (SETUPAPI.@)
|
||||
*/
|
||||
|
@ -2000,15 +2009,15 @@ BOOL WINAPI SetupGetBinaryField( PINFCONTEXT context, DWORD index, BYTE *buffer,
|
|||
{
|
||||
const WCHAR *p;
|
||||
DWORD value = 0;
|
||||
for (p = field->text; *p && iswxdigit(*p); p++)
|
||||
int d;
|
||||
for (p = field->text; *p && (d = xdigit_to_int(*p)) != -1; p++)
|
||||
{
|
||||
if ((value <<= 4) > 255)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_DATA );
|
||||
return FALSE;
|
||||
}
|
||||
if (*p <= '9') value |= (*p - '0');
|
||||
else value |= (towlower(*p) - 'a' + 10);
|
||||
value |= d;
|
||||
}
|
||||
buffer[i - index] = value;
|
||||
}
|
||||
|
|
|
@ -10,4 +10,4 @@ files:
|
|||
dlls/setupapi/setupcab.c: dll/win32/setupapi/setupcab.c
|
||||
dlls/setupapi/stringtable.c: dll/win32/setupapi/stringtable_wine.c
|
||||
tags:
|
||||
wine: 4a3cd01bd150c27d7fd40d04fc92b173f2f988af
|
||||
wine: d580d2c2fdad7f6f00dd12923e475298c019b660
|
||||
|
|
Loading…
Reference in a new issue