Skip to content

Commit

Permalink
DynamicDependencies: fix PCWSTR[] access (#872)
Browse files Browse the repository at this point in the history
* Fixed cert enumeration (incorrect probing caused failures)

* Fixed incorrect PCWSTR[] access
  • Loading branch information
DrusTheAxe authored May 27, 2021
1 parent 51d5fe2 commit 5f7911e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dev/DynamicDependency/PackageDependency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ std::vector<std::wstring> MddCore::PackageDependency::FindPackagesByFamily() con
THROW_IF_WIN32_ERROR(FindPackagesByPackageFamily(m_packageFamilyName.c_str(), PACKAGE_FILTER_HEAD | PACKAGE_FILTER_DIRECT, &count, packageFullNames.get(), &bufferLength, buffer.get(), nullptr));

std::vector<std::wstring> packageFullNamesList;
auto packageFullName{ *packageFullNames.get() };
for (UINT32 index=0; index < count; ++index, ++packageFullName)
for (UINT32 index=0; index < count; ++index)
{
const auto packageFullName{ packageFullNames[index] };
packageFullNamesList.push_back(std::wstring(packageFullName));
}
return packageFullNamesList;
Expand Down
5 changes: 3 additions & 2 deletions tools/DevCheck.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,15 @@ function Test-DevTestCert
$pfx = Get-PfxCertificate -FilePath $path
$thumbprint = $pfx.Thumbprint

$cert = Get-ChildItem -Path "cert:\LocalMachine\TrustedPeople\$thumbprint"
if ([string]::IsNullOrEmpty($cert))
$cert_path = "cert:\LocalMachine\TrustedPeople\$thumbprint"
if (-not(Test-Path -Path $cert_path))
{
Write-Host 'Test certificate...Not Found'
$global:issues += 1
}
else
{
$cert = Get-ChildItem -Path $cert_path
$expiration = $cert.NotAfter
$now = Get-Date
if ($expiration -lt $now)
Expand Down

0 comments on commit 5f7911e

Please sign in to comment.