diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-04-09 18:31:36 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-04-09 21:04:37 +0200 |
commit | 5769851b4cbf1985004ab35bafd5ee69773b8db1 (patch) | |
tree | 18b4b23c52743ec979da2a49b8165f94bbb558f5 /ucb | |
parent | fae050ebf984fb70fc8328419c6da4b8895d582f (diff) |
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@collabora.com>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonSession.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
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()) ); } } } |