From 7fc98802ecd6d9e198ae37269f10522286db987e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 1 Sep 2020 17:14:10 +0200 Subject: Create OUString from storeFindData m_pszName and m_nLength ...assuming that (a) m_nLength does always reflect the actual m_pszName length, and (b) that way of constructing an OUString from a pointer was not chosen deliberately to cut of the string at a potential embedded NUL. (This change is a prerequisite for making the OUString ctor taking a raw pointer explicit.) Change-Id: I75519825cd6b60a7c308a3697bfbfc40afb2d1c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102076 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- registry/source/keyimpl.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'registry/source/keyimpl.cxx') diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index f3cb2d00b34e..e76512e9e19a 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -111,7 +111,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK { if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR ) { - OUString const sSubKeyName = iter.m_pszName; + OUString const sSubKeyName(iter.m_pszName, iter.m_nLength); ORegKey* pOpenSubKey = nullptr; _ret = pKey->openKey(sSubKeyName, reinterpret_cast(&pOpenSubKey)); @@ -175,7 +175,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName, { if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR) { - OUString const sSubKeyName = iter.m_pszName; + OUString const sSubKeyName(iter.m_pszName, iter.m_nLength); OUString sFullKeyName(pKey->getName()); if (sFullKeyName.getLength() > 1) -- cgit v1.2.3