[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - tools/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 4 11:09:03 UTC 2021
tools/source/misc/json_writer.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 9688743c56d2befe96fa799eea16b4a00e0419e1
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Oct 2 21:31:44 2021 +0100
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Oct 4 13:08:29 2021 +0200
fix buffer overruns in JsonWriter::put with UTF-8 values
Change-Id: I694585a1a540bfefc0e59bd58d8033a96ca35acb
Signed-off-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123011
diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx
index 839fbfd2eb47..229c96f4efdb 100644
--- a/tools/source/misc/json_writer.cxx
+++ b/tools/source/misc/json_writer.cxx
@@ -121,7 +121,7 @@ void JsonWriter::endStruct()
void JsonWriter::put(const char* pPropName, const OUString& rPropVal)
{
auto nPropNameLength = strlen(pPropName);
- auto nWorstCasePropValLength = rPropVal.getLength() * 2;
+ auto nWorstCasePropValLength = rPropVal.getLength() * 3;
ensureSpace(nPropNameLength + nWorstCasePropValLength + 8);
addCommaBeforeField();
@@ -214,7 +214,7 @@ void JsonWriter::put(const char* pPropName, const OUString& rPropVal)
void JsonWriter::put(const char* pPropName, const OString& rPropVal)
{
auto nPropNameLength = strlen(pPropName);
- auto nWorstCasePropValLength = rPropVal.getLength();
+ auto nWorstCasePropValLength = rPropVal.getLength() * 2;
ensureSpace(nPropNameLength + nWorstCasePropValLength + 8);
addCommaBeforeField();
More information about the Libreoffice-commits
mailing list