diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-10-19 09:28:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-10-19 16:48:12 +0200 |
commit | d2f1f5005e0df725d9f1830e278b06a151c860b6 (patch) | |
tree | e35166ad88362154ba69a2556321232d4a82d6f7 /ucb | |
parent | eb111a81599e78ff4b920fbcdebcf08e18f4a3f3 (diff) |
Related: tdf#145169 use of freed pointer in gio create folder
and
Related: tdf#145169 missing path separator in gio create folder
Change-Id: I7fa98e05261b6c1ff7c053b5f563ea97bd67ed00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123801
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/gio/gio_content.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index 1e084d638126..1edca770b394 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -684,7 +684,7 @@ css::uno::Sequence< css::uno::Any > Content::setPropertyValues( aEvent.PropertyHandle = -1; sal_Int32 nChanged = 0, nTitlePos = -1; - const char *newName = nullptr; + OUString aNewTitle; css::uno::Sequence< css::beans::PropertyChangeEvent > aChanges(nCount); css::uno::Sequence< css::uno::Any > aRet( nCount ); @@ -704,7 +704,6 @@ css::uno::Sequence< css::uno::Any > Content::setPropertyValues( } else if ( rValue.Name == "Title" ) { - OUString aNewTitle; if (!( rValue.Value >>= aNewTitle )) { aRet[ n ] <<= css::beans::IllegalTypeException @@ -723,7 +722,7 @@ css::uno::Sequence< css::uno::Any > Content::setPropertyValues( } OString sNewTitle = OUStringToOString(aNewTitle, RTL_TEXTENCODING_UTF8); - newName = sNewTitle.getStr(); + const char *newName = sNewTitle.getStr(); const char *oldName = g_file_info_get_name( pInfo); if (!newName || !oldName || strcmp(newName, oldName)) @@ -744,7 +743,6 @@ css::uno::Sequence< css::uno::Any > Content::setPropertyValues( { SAL_WARN("ucb.ucp.gio", "Unknown property " << rValue.Name); aRet[ n ] <<= getReadOnlyException( static_cast< cppu::OWeakObject * >(this) ); - //TODO } } @@ -764,8 +762,11 @@ css::uno::Sequence< css::uno::Any > Content::setPropertyValues( { if (nTitlePos > -1) { - OUString aNewURL = getParentURL() + - OUString( newName, strlen(newName), RTL_TEXTENCODING_UTF8 ); + OUString aNewURL = getParentURL(); + if (!aNewURL.isEmpty() && aNewURL[aNewURL.getLength() - 1] != '/') + aNewURL += "/"; + aNewURL += aNewTitle; + css::uno::Reference< css::ucb::XContentIdentifier > xNewId = new ::ucbhelper::ContentIdentifier( aNewURL ); |