Browse Source

HPCC-18762 Avoid buffer overrun writing string to ptree IXMLWriter

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 7 years ago
parent
commit
31043ff07e
1 changed files with 2 additions and 8 deletions
  1. 2 8
      rtl/eclrtl/rtlformat.cpp

+ 2 - 8
rtl/eclrtl/rtlformat.cpp

@@ -832,18 +832,12 @@ void CPropertyTreeWriter::outputQuoted(const char *text)
 
 void CPropertyTreeWriter::outputString(unsigned len, const char *field, const char *fieldname)
 {
-    unsigned olen = len;
     if (flags & XWFtrim)
         len = rtlTrimStrLen(len, field);
     if ((flags & XWFopt) && (rtlTrimStrLen(len, field) == 0))
         return;
-    if (olen != len)
-    {
-        StringBuffer tmp(len, field);
-        target->setProp(fieldname, tmp.str());
-    }
-    else
-        target->setProp(fieldname, field);
+    StringBuffer tmp(len, field);
+    target->setProp(fieldname, tmp.str());
 }