Skip to content

Commit 5f7911e

Browse files
authored
DynamicDependencies: fix PCWSTR[] access (#872)
* Fixed cert enumeration (incorrect probing caused failures) * Fixed incorrect PCWSTR[] access
1 parent 51d5fe2 commit 5f7911e

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

dev/DynamicDependency/PackageDependency.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ std::vector<std::wstring> MddCore::PackageDependency::FindPackagesByFamily() con
4242
THROW_IF_WIN32_ERROR(FindPackagesByPackageFamily(m_packageFamilyName.c_str(), PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT, &count, packageFullNames.get(), &bufferLength, buffer.get(), nullptr));
4343

4444
std::vector<std::wstring> packageFullNamesList;
45-
auto packageFullName{ *packageFullNames.get() };
46-
for (UINT32 index=0; index < count; ++index, ++packageFullName)
45+
for (UINT32 index=0; index < count; ++index)
4746
{
47+
const auto packageFullName{ packageFullNames[index] };
4848
packageFullNamesList.push_back(std::wstring(packageFullName));
4949
}
5050
return packageFullNamesList;

tools/DevCheck.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,15 @@ function Test-DevTestCert
255255
$pfx = Get-PfxCertificate -FilePath $path
256256
$thumbprint = $pfx.Thumbprint
257257

258-
$cert = Get-ChildItem -Path "cert:\LocalMachine\TrustedPeople\$thumbprint"
259-
if ([string]::IsNullOrEmpty($cert))
258+
$cert_path = "cert:\LocalMachine\TrustedPeople\$thumbprint"
259+
if (-not(Test-Path -Path $cert_path))
260260
{
261261
Write-Host 'Test certificate...Not Found'
262262
$global:issues += 1
263263
}
264264
else
265265
{
266+
$cert = Get-ChildItem -Path $cert_path
266267
$expiration = $cert.NotAfter
267268
$now = Get-Date
268269
if ($expiration -lt $now)

0 commit comments

Comments
 (0)