diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-01-30 11:25:19 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-01-30 11:25:19 +0100 |
commit | 86b4603766f45f5a15fb59728839fed1da6fd4da (patch) | |
tree | a0d3ee84290e5e6dfa68a620ae9bcc675590f361 /ucb | |
parent | 14f58328d5b92abb406e0c977cc769d17e2eaa2c (diff) |
coverity#705438, obey preconditions of OUString functions
Change-Id: Ifd8d9a258ca69fbcdafbbb7b8eedd1905e3473bd
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/ftp/ftpurl.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx index b8b06f0d4721..284a24981b7f 100644 --- a/ucb/source/ucp/ftp/ftpurl.cxx +++ b/ucb/source/ucp/ftp/ftpurl.cxx @@ -23,7 +23,11 @@ *************************************************************************/ -#include <memory> +#include <sal/config.h> + +#include <cstring> +#include <vector> + #include <rtl/ustrbuf.hxx> #include <com/sun/star/ucb/OpenMode.hpp> #include <string.h> @@ -548,9 +552,10 @@ OUString FTPURL::net_title() const // Format of current working directory: // 257 "/bla/bla" is current directory sal_Int32 index1 = aNetTitle.lastIndexOf("257"); - index1 = 1+aNetTitle.indexOf('"',index1); - sal_Int32 index2 = aNetTitle.indexOf('"',index1); - aNetTitle = aNetTitle.copy(index1,index2-index1); + index1 = aNetTitle.indexOf('"', index1 + std::strlen("257")) + 1; + sal_Int32 index2 = aNetTitle.indexOf('"', index1); + aNetTitle = index2 > index1 + ? aNetTitle.copy(index1, index2 - index1) : OUString(); if( aNetTitle != "/" ) { index1 = aNetTitle.lastIndexOf('/'); aNetTitle = aNetTitle.copy(1+index1); |