[Libreoffice-commits] core.git: ucb/source
Stephan Bergmann
sbergman at redhat.com
Thu Jan 30 02:25:48 PST 2014
ucb/source/ucp/ftp/ftpurl.cxx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 86b4603766f45f5a15fb59728839fed1da6fd4da
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Jan 30 11:25:19 2014 +0100
coverity#705438, obey preconditions of OUString functions
Change-Id: Ifd8d9a258ca69fbcdafbbb7b8eedd1905e3473bd
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index b8b06f0..284a249 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);
More information about the Libreoffice-commits
mailing list