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'; }