From 465d9050569b316f7c4a362dd437a99fae257e3f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:56:47 +0100 Subject: [PATCH] VpkLib: fix bug in GetManifest() Check if the parsing was actually successful, else free and return nullptr. The null check at call site never worked since we never return null on failure. --- r5dev/vpklib/packedstore.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/r5dev/vpklib/packedstore.cpp b/r5dev/vpklib/packedstore.cpp index a7856e67..1f4ddb61 100644 --- a/r5dev/vpklib/packedstore.cpp +++ b/r5dev/vpklib/packedstore.cpp @@ -189,7 +189,11 @@ static KeyValues* GetManifest(const CUtlString& workspacePath, const CUtlString& outPath.Format("%s%s%s.txt", workspacePath.Get(), "manifest/", manifestFile.Get()); KeyValues* pManifestKV = new KeyValues("BuildManifest"); - pManifestKV->LoadFromFile(FileSystem(), outPath.Get(), "PLATFORM"); + if (!pManifestKV->LoadFromFile(FileSystem(), outPath.Get(), "PLATFORM")) + { + pManifestKV->DeleteThis(); + return nullptr; + } return pManifestKV; } @@ -278,7 +282,7 @@ static bool GetEntryValues(CUtlVector& entryValues, if (!pManifestKV) { - Warning(eDLL_T::FS, "Invalid VPK build manifest KV; unable to parse entry list\n"); + Error(eDLL_T::FS, NO_ERROR, "Invalid or missing VPK build manifest KV; unable to parse entry list\n"); return false; }