Kaydet (Commit) 86b46037 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

coverity#705438, obey preconditions of OUString functions

Change-Id: Ifd8d9a258ca69fbcdafbbb7b8eedd1905e3473bd
üst 14f58328
...@@ -23,7 +23,11 @@ ...@@ -23,7 +23,11 @@
*************************************************************************/ *************************************************************************/
#include <memory> #include <sal/config.h>
#include <cstring>
#include <vector>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <com/sun/star/ucb/OpenMode.hpp> #include <com/sun/star/ucb/OpenMode.hpp>
#include <string.h> #include <string.h>
...@@ -548,9 +552,10 @@ OUString FTPURL::net_title() const ...@@ -548,9 +552,10 @@ OUString FTPURL::net_title() const
// Format of current working directory: // Format of current working directory:
// 257 "/bla/bla" is current directory // 257 "/bla/bla" is current directory
sal_Int32 index1 = aNetTitle.lastIndexOf("257"); sal_Int32 index1 = aNetTitle.lastIndexOf("257");
index1 = 1+aNetTitle.indexOf('"',index1); index1 = aNetTitle.indexOf('"', index1 + std::strlen("257")) + 1;
sal_Int32 index2 = aNetTitle.indexOf('"',index1); sal_Int32 index2 = aNetTitle.indexOf('"', index1);
aNetTitle = aNetTitle.copy(index1,index2-index1); aNetTitle = index2 > index1
? aNetTitle.copy(index1, index2 - index1) : OUString();
if( aNetTitle != "/" ) { if( aNetTitle != "/" ) {
index1 = aNetTitle.lastIndexOf('/'); index1 = aNetTitle.lastIndexOf('/');
aNetTitle = aNetTitle.copy(1+index1); aNetTitle = aNetTitle.copy(1+index1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment