From ac4d33e2c1563c4ab17f7724665a527c4b7cf023 Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Thu, 20 Apr 2023 21:53:45 +0200 Subject: [PATCH] Update sbieiniserver.cpp --- Sandboxie/core/svc/sbieiniserver.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sandboxie/core/svc/sbieiniserver.cpp b/Sandboxie/core/svc/sbieiniserver.cpp index ef6199bf..6dbc9c88 100644 --- a/Sandboxie/core/svc/sbieiniserver.cpp +++ b/Sandboxie/core/svc/sbieiniserver.cpp @@ -1174,8 +1174,10 @@ ULONG SbieIniServer::AddSetting(MSG_HEADER* msg, bool insert) { if (_wcsicmp(I->Name.c_str(), req->setting) == 0) { // !insert -> append -> find last entry - if(!insert || pos == pSection->Entries.end()) + if (!insert || pos == pSection->Entries.end()) { pos = I; + if (!insert) pos++; + } if (_wcsicmp(I->Value.c_str(), req->value) == 0) { // this value is already present, so let's abort right here return STATUS_SUCCESS;