[Libreoffice-commits] core.git: ucb/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 9 19:05:12 UTC 2020


 ucb/source/ucp/webdav-neon/NeonSession.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 5769851b4cbf1985004ab35bafd5ee69773b8db1
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Apr 9 18:31:36 2020 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Apr 9 21:04:37 2020 +0200

    Error strings are not guaranteed to be ASCII
    
    E.g., it happened to be this string with Cyrillic characters in my testing:
    
        SSL handshake failed: Удаленный хост принудительно разорвал существующее подключение.
    
    Change-Id: I4721560412ab6543206cd13c8729dc8cc851eefd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91905
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index 46a60b4d179e..c178c1e90238 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <sal/log.hxx>
 #include <osl/diagnose.h>
+#include <osl/thread.h>
 #include <osl/time.h>
 #include <ne_socket.h>
 #include <ne_auth.h>
@@ -1826,8 +1827,8 @@ void NeonSession::HandleError( int nError,
 
         case NE_ERROR:        // Generic error
         {
-            OUString aText = OUString::createFromAscii(
-                ne_get_error( m_pHttpSession ) );
+            const char* sErr = ne_get_error(m_pHttpSession);
+            OUString aText(sErr, strlen(sErr), osl_getThreadTextEncoding());
 
             sal_uInt16 code = makeStatusCode( aText );
 
@@ -1987,9 +1988,9 @@ void NeonSession::HandleError( int nError,
         default:
         {
             SAL_WARN( "ucb.ucp.webdav", "Unknown Neon error code!" );
+            const char* sErr = ne_get_error(m_pHttpSession);
             throw DAVException( DAVException::DAV_HTTP_ERROR,
-                                OUString::createFromAscii(
-                                    ne_get_error( m_pHttpSession ) ) );
+                                OUString(sErr, strlen(sErr), osl_getThreadTextEncoding()) );
         }
     }
 }


More information about the Libreoffice-commits mailing list