From d7c999c8f319a1b1a9d5de605a4fefb108821ba8 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 12 Oct 2021 15:10:51 -0400 Subject: [PATCH 1/2] Correct calls to `StrTo(Unicode|Ansi)` to use the correct size. --- Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp index 66a91d4b..8a2feac6 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp @@ -4911,7 +4911,7 @@ UInt8 VaultAgeFindOrCreateChildAgeLink( // First, try to find an already existing ChildAge char name[MAX_PATH]; - StrToAnsi(name, parentAgeName, arrsize(parentAgeName)); + StrToAnsi(name, parentAgeName, arrsize(name)); plAgeInfoStruct search; search.SetAgeFilename(name); @@ -4933,7 +4933,7 @@ UInt8 VaultAgeFindOrCreateChildAgeLink( if (RelVaultNode* rvnChildAges = rvnParentInfo->GetChildAgeInfoListNodeIncRef(plVault::kChildAgesFolder, 1)) { const char* ageName = info->GetAgeFilename(); wchar hack[MAX_PATH]; - StrToUnicode(hack, ageName, arrsize(ageName)); + StrToUnicode(hack, ageName, arrsize(hack)); // Search for our age NetVaultNode* temp = NEWZERO(NetVaultNode); From c65b062e0f01236630befe9184b1c92f2566bddf Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 17 Oct 2021 14:48:23 -0400 Subject: [PATCH 2/2] Fix misplaced return value. The "wait for server response" return value was short-circuiting the "already done" value. The previous commit fixed always needing a new instance, exposing this problem. --- Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp index 8a2feac6..abd4a4b5 100644 --- a/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp +++ b/Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp @@ -4964,11 +4964,12 @@ UInt8 VaultAgeFindOrCreateChildAgeLink( nil, p ); + + retval = FALSE; } temp->DecRef(); rvnChildAges->DecRef(); - retval = FALSE; } rvnParentInfo->DecRef();