From 9fb8f4cb6bc80f49f2c7185f5303a44419605650 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Sun, 12 Mar 2023 10:59:20 +0100 Subject: [PATCH] Fix StringBuf.add() --- src/util/helpers/StringBuf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/helpers/StringBuf.h b/src/util/helpers/StringBuf.h index 8c7b1645..432fa7a1 100644 --- a/src/util/helpers/StringBuf.h +++ b/src/util/helpers/StringBuf.h @@ -46,10 +46,11 @@ public: { size_t remainingLen = this->limit - this->length; size_t copyLen = appendedStr.size(); - if (remainingLen > copyLen) + if (remainingLen < copyLen) copyLen = remainingLen; char* outputStart = (char*)(this->str + this->length); std::copy(appendedStr.data(), appendedStr.data() + copyLen, outputStart); + length += copyLen; outputStart[copyLen] = '\0'; }