Skip to content

Commit 48beb04

Browse files
HBeluscakatahiromz
andcommitted
[SETUPAPI] Add missing NULL parameter checks in SetupOpenInfFileW and SetupDiGetINFClassW (reactos#7573)
Based on PR reactos#5673, ROSTESTS-388 Co-authored-by: Katayama Hirofumi MZ <[email protected]>
1 parent 5ec739b commit 48beb04

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

dll/win32/setupapi/parser.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,11 +1235,18 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
12351235

12361236
TRACE("%s %s %lx %p\n", debugstr_w(name), debugstr_w(class), style, error);
12371237

1238+
#ifdef __REACTOS__
12381239
if (style & ~(INF_STYLE_OLDNT | INF_STYLE_WIN4))
12391240
{
12401241
SetLastError(ERROR_INVALID_PARAMETER);
12411242
return (HINF)INVALID_HANDLE_VALUE;
12421243
}
1244+
if (!name)
1245+
{
1246+
SetLastError(ERROR_INVALID_PARAMETER);
1247+
return (HINF)INVALID_HANDLE_VALUE;
1248+
}
1249+
#endif // __REACTOS__
12431250

12441251
if (strchrW( name, '\\' ) || strchrW( name, '/' ))
12451252
{
@@ -2326,6 +2333,12 @@ SetupDiGetINFClassW(
23262333
TRACE("%s %p %p %ld %p\n", debugstr_w(InfName), ClassGuid,
23272334
ClassName, ClassNameSize, RequiredSize);
23282335

2336+
if (!InfName || !ClassGuid || !ClassName || ClassNameSize == 0)
2337+
{
2338+
SetLastError(ERROR_INVALID_PARAMETER);
2339+
return FALSE;
2340+
}
2341+
23292342
/* Open .inf file */
23302343
hInf = SetupOpenInfFileW(InfName, NULL, INF_STYLE_WIN4, NULL);
23312344
if (hInf == INVALID_HANDLE_VALUE)

0 commit comments

Comments
 (0)