[SETUPAPI] Add missing NULL parameter checks in SetupOpenInfFileW and SetupDiGetINFClassW.

Based on PR #5673, ROSTESTS-388

Co-authored-by: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
This commit is contained in:
Hermès Bélusca-Maïto 2023-09-28 12:50:49 +02:00
parent 2788057a2d
commit 0632def000
No known key found for this signature in database
GPG Key ID: 3B2539C65E7B93D0

View File

@ -1232,11 +1232,18 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
TRACE("%s %s %lx %p\n", debugstr_w(name), debugstr_w(class), style, error);
#ifdef __REACTOS__
if (style & ~(INF_STYLE_OLDNT | INF_STYLE_WIN4))
{
SetLastError(ERROR_INVALID_PARAMETER);
return (HINF)INVALID_HANDLE_VALUE;
}
if (!name)
{
SetLastError(ERROR_INVALID_PARAMETER);
return (HINF)INVALID_HANDLE_VALUE;
}
#endif // __REACTOS__
if (wcschr( name, '\\' ) || wcschr( name, '/' ))
{
@ -2329,6 +2336,12 @@ SetupDiGetINFClassW(
TRACE("%s %p %p %ld %p\n", debugstr_w(InfName), ClassGuid,
ClassName, ClassNameSize, RequiredSize);
if (!InfName || !ClassGuid || !ClassName || ClassNameSize == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* Open .inf file */
hInf = SetupOpenInfFileW(InfName, NULL, INF_STYLE_WIN4, NULL);
if (hInf == INVALID_HANDLE_VALUE)