From 54054aaea74d524a05f899f8af27e2a65e17be52 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 13 Apr 2021 13:04:02 +0300 Subject: 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 Reviewed-by: Mike Kaganski --- sax/source/tools/fastattribs.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sax/source') 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'; } -- cgit