diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-13 13:04:02 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-13 20:39:45 +0200 |
commit | 54054aaea74d524a05f899f8af27e2a65e17be52 (patch) | |
tree | 80c4a9c38a1aa8e03e0d8aebf2f14c6389f03c00 /sax | |
parent | dbe582ffa0cbbb2b4182e785fd3c37afc7863b97 (diff) |
tdf#79591: No need to use getStr here
7ea1bbe712cef48a97faffdf03b45f2812a93e62 had abused the C-style strings,
and relied on the names containing zero byte to be truncated on the byte.
However, that would only work for names with zero bytes, not with other
control characters. Additionally, that prevented the initial names from
correct round-trip.
This reverts the older fix, and makes sure to handle the attributes with
zeroes correctly (using memcpy instead of strncpy).
It also removes several similar unneeded uses of getStr.
Change-Id: I6c52874d99fe9eb9ccbe0c9a9b57e3b51c45a19f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114040
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/tools/fastattribs.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index 0ef8828b187d..554232260aef 100644 --- a/sax/source/tools/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -111,7 +111,7 @@ void FastAttributeList::add( sal_Int32 nToken, const char* pValue, size_t nValue mpChunk = p; } - strncpy(mpChunk + nWritePosition, pValue, nValueLength); + memcpy(mpChunk + nWritePosition, pValue, nValueLength); mpChunk[nWritePosition + nValueLength] = '\0'; } |