Skip to content

Commit 8a8e710

Browse files
fix potential null pointer dereference found by Coverity (openresty#2043)
* fix potential null pointer dereference found by Coverity *** CID 352757: Null pointer dereferences (FORWARD_NULL) /src/ngx_http_lua_socket_tcp.c: 1733 in ngx_http_lua_ffi_socket_tcp_sslhandshake() 1727 #else 1728 *errmsg = "no OCSP support"; 1729 return NGX_ERROR; 1730 #endif 1731 } 1732 >>> CID 352757: Null pointer dereferences (FORWARD_NULL) >>> Dereferencing null pointer "server_name". 1733 if (server_name->len == 0) { 1734 u->ssl_name.len = 0; 1735 1736 } else { 1737 if (u->ssl_name.data) { 1738 /* buffer already allocated */ Co-authored-by: lijunlong <[email protected]>
1 parent 86e1a64 commit 8a8e710

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ngx_http_lua_socket_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ ngx_http_lua_ffi_socket_tcp_sslhandshake(ngx_http_request_t *r,
17301730
#endif
17311731
}
17321732

1733-
if (server_name->len == 0) {
1733+
if (server_name == NULL || server_name->len == 0) {
17341734
u->ssl_name.len = 0;
17351735

17361736
} else {

0 commit comments

Comments
 (0)