projects
/
umurmur.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix crash at client disconnect when using PolarSSL >= 1.2.6
[umurmur.git]
/
src
/
ssl.c
diff --git
a/src/ssl.c
b/src/ssl.c
index 2218864868e39daa3cdea1a04666e8ec863e91f9..86e35a5f1fed9dd795cba995cf18d21dd35ff7cb 100644
(file)
--- a/
src/ssl.c
+++ b/
src/ssl.c
@@
-154,7
+154,7
@@
static void initKey()
int urandom_bytes(void *ctx, unsigned char *dest, size_t len)
{
int cur;
int urandom_bytes(void *ctx, unsigned char *dest, size_t len)
{
int cur;
-
+
while (len) {
cur = read(urandom_fd, dest, len);
if (cur < 0)
while (len) {
cur = read(urandom_fd, dest, len);
if (cur < 0)
@@
-275,7
+275,7
@@
int SSLi_nonblockaccept(SSL_handle_t *ssl, bool_t *SSLready)
if (rc != 0) {
if (rc == POLARSSL_ERR_NET_WANT_READ || rc == POLARSSL_ERR_NET_WANT_WRITE) {
return 0;
if (rc != 0) {
if (rc == POLARSSL_ERR_NET_WANT_READ || rc == POLARSSL_ERR_NET_WANT_WRITE) {
return 0;
- } else if (POLARSSL_ERR_X509_CERT_VERIFY_FAILED) { /* Allow this (selfsigned etc) */
+ } else if (
rc ==
POLARSSL_ERR_X509_CERT_VERIFY_FAILED) { /* Allow this (selfsigned etc) */
return 0;
} else {
Log_warn("SSL handshake failed: %d", rc);
return 0;
} else {
Log_warn("SSL handshake failed: %d", rc);
@@
-324,7
+324,10
@@
void SSLi_shutdown(SSL_handle_t *ssl)
void SSLi_free(SSL_handle_t *ssl)
{
Log_debug("SSLi_free");
void SSLi_free(SSL_handle_t *ssl)
{
Log_debug("SSLi_free");
- free(ssl->session); /* XXX - Hmmm. */
+#if (POLARSSL_VERSION_MINOR <= 2 && POLARSSL_VERSION_PATCH < 6)
+ free(ssl->session); /* Workaround for memory leak in PolarSSL < 1.2.6 */
+ ssl->session = NULL;
+#endif
ssl_free(ssl);
free(ssl);
}
ssl_free(ssl);
free(ssl);
}