- Fixed crash in tls_read (unchecked null pointer)
authorBenoît LeBlanc <benoit.leblanc@awakecoding.com>
Fri, 18 Oct 2013 20:23:29 +0000 (16:23 -0400)
committerBenoît LeBlanc <benoit.leblanc@awakecoding.com>
Fri, 18 Oct 2013 20:23:29 +0000 (16:23 -0400)
- also check for empty string on username and password to launch authentication callback

libfreerdp/core/nla.c
libfreerdp/crypto/tls.c

index 2978a2a..1bface6 100644 (file)
@@ -119,7 +119,8 @@ int credssp_ntlm_client_init(rdpCredssp* credssp)
        settings = credssp->settings;
        instance = (freerdp*) settings->instance;
 
-       if ((settings->Password == NULL) || (settings->Username == NULL))
+       if ((settings->Password == NULL ) || (settings->Username == NULL)
+                       || (!strlen(settings->Password)) || (!strlen(settings->Username)))
        {
                if (instance->Authenticate)
                {
index ae31758..9d2c407 100644 (file)
@@ -373,9 +373,9 @@ int tls_read(rdpTls* tls, BYTE* data, int length)
        int error;
        int status;
 
-       status = SSL_read(tls->ssl, data, length);
+       status = tls ? SSL_read(tls->ssl, data, length) : -1;
 
-       if (status <= 0)
+       if (tls && status <= 0)
        {
                error = SSL_get_error(tls->ssl, status);