From: Seonah Moon Date: Wed, 27 May 2020 06:00:25 +0000 (+0900) Subject: fix improper use of negative value X-Git-Tag: submit/tizen/20200604.101817~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=34e25bffc554f491cd81e64d512acf85089976ca;p=platform%2Fupstream%2Flibwebsockets.git fix improper use of negative value https://github.com/warmcat/libwebsockets/commit/bce4d762e5a6b912f5993fcf3c8ccf94a08c88ca Change-Id: I5eab3a8b58acb23c0339d33109a7614c93e8e93a --- diff --git a/lib/tls/openssl/openssl-ssl.c b/lib/tls/openssl/openssl-ssl.c index afe4f978..0ea77414 100644 --- a/lib/tls/openssl/openssl-ssl.c +++ b/lib/tls/openssl/openssl-ssl.c @@ -344,6 +344,7 @@ lws_ssl_info_callback(const SSL *ssl, int where, int ret) struct lws *wsi; struct lws_context *context; struct lws_ssl_info si; + int fd; #ifndef USE_WOLFSSL context = (struct lws_context *)SSL_CTX_get_ex_data( @@ -356,7 +357,12 @@ lws_ssl_info_callback(const SSL *ssl, int where, int ret) #endif if (!context) return; - wsi = wsi_from_fd(context, SSL_get_fd(ssl)); + + fd = SSL_get_fd(ssl); + if (fd < 0 || (fd - lws_plat_socket_offset()) < 0) + return; + + wsi = wsi_from_fd(context, fd); if (!wsi) return;