aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Kaufmann <mail@michael-kaufmann.ch>2017-02-08 22:09:31 +0100
committerMichael Kaufmann <mail@michael-kaufmann.ch>2017-02-08 22:24:21 +0100
commita7e4348cf8d9e3ca4ef7020de4540a7257bc5b30 (patch)
treefe0ae7bf7c8dabad2e8f71512eaa4a63aa80c2ce /lib
parent3cc2229c13ceeed82f7cea099573ccc326331627 (diff)
polarssl, mbedtls: Fix detection of pending data
Reported-by: Dan Fandrich Bug: https://curl.haxx.se/mail/lib-2017-02/0032.html
Diffstat (limited to 'lib')
-rw-r--r--lib/vtls/mbedtls.c4
-rw-r--r--lib/vtls/polarssl.c4
2 files changed, 2 insertions, 6 deletions
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index 748828023..07239bf26 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -937,9 +937,7 @@ void Curl_mbedtls_cleanup(void)
int Curl_mbedtls_data_pending(const struct connectdata *conn, int sockindex)
{
- mbedtls_ssl_context *ssl =
- (mbedtls_ssl_context *)&conn->ssl[sockindex].ssl;
- return ssl->in_msglen != 0;
+ return mbedtls_ssl_get_bytes_avail(&conn->ssl[sockindex].ssl) != 0;
}
#endif /* USE_MBEDTLS */
diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c
index 1a9421d82..e5346ce3d 100644
--- a/lib/vtls/polarssl.c
+++ b/lib/vtls/polarssl.c
@@ -819,9 +819,7 @@ void Curl_polarssl_cleanup(void)
int Curl_polarssl_data_pending(const struct connectdata *conn, int sockindex)
{
- ssl_context *ssl =
- (ssl_context *)&conn->ssl[sockindex].ssl;
- return ssl->in_msglen != 0;
+ return ssl_get_bytes_avail(&conn->ssl[sockindex].ssl) != 0;
}
#endif /* USE_POLARSSL */