Skip to content

Commit 4185ffc

Browse files
chipitsinezhuizhuhaomeng
authored andcommitted
bugfix: fixed possible null pointer dereference found by Coverity.
1 parent c3d3f6e commit 4185ffc

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/ngx_stream_lua_ssl_certby.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,16 +440,19 @@ ngx_stream_lua_log_ssl_cert_error(ngx_log_t *log, u_char *buf, size_t len)
440440

441441
c = log->data;
442442

443-
if (c->addr_text.len) {
444-
p = ngx_snprintf(buf, len, ", client: %V", &c->addr_text);
445-
len -= p - buf;
446-
buf = p;
447-
}
443+
if (c != NULL) {
444+
if (c->addr_text.len) {
445+
p = ngx_snprintf(buf, len, ", client: %V", &c->addr_text);
446+
len -= p - buf;
447+
buf = p;
448+
}
448449

449-
if (c && c->listening && c->listening->addr_text.len) {
450-
p = ngx_snprintf(buf, len, ", server: %V", &c->listening->addr_text);
451-
/* len -= p - buf; */
452-
buf = p;
450+
if (c->listening && c->listening->addr_text.len) {
451+
p = ngx_snprintf(buf, len, ", server: %V",
452+
&c->listening->addr_text);
453+
/* len -= p - buf; */
454+
buf = p;
455+
}
453456
}
454457

455458
return buf;
@@ -1423,7 +1426,7 @@ ngx_stream_lua_ffi_ssl_verify_client(ngx_stream_lua_request_t *r,
14231426

14241427
if (depth < 0) {
14251428
sscf = ngx_stream_get_module_srv_conf(r->session,
1426-
ngx_stream_ssl_module);
1429+
ngx_stream_ssl_module);
14271430
if (sscf != NULL) {
14281431
depth = sscf->verify_depth;
14291432

0 commit comments

Comments
 (0)