From 9f1c8ac02013b0742866531cf7383c168b69857c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 23 Dec 2018 16:53:39 +0100 Subject: [PATCH] [USETUP] Check for invalid INF handles before doing operations. --- base/setup/usetup/spapisup/infsupp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/base/setup/usetup/spapisup/infsupp.c b/base/setup/usetup/spapisup/infsupp.c index af18c491c15..98212975cb4 100644 --- a/base/setup/usetup/spapisup/infsupp.c +++ b/base/setup/usetup/spapisup/infsupp.c @@ -43,6 +43,8 @@ WINAPI SetupCloseInfFile( IN HINF InfHandle) { + if (InfHandle == INVALID_HANDLE_VALUE) + return; InfCloseFile(InfHandle); } @@ -58,6 +60,9 @@ SetupFindFirstLineW( PINFCONTEXT pContext; BOOL ret; + if (InfHandle == INVALID_HANDLE_VALUE) + return FALSE; + ret = InfFindFirstLine(InfHandle, Section, Key, &pContext); if (!ret) return FALSE;