Skip to content

chore: fix possible null pointer dereference found by Coverity #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2021

Conversation

chipitsine
Copy link
Contributor

785    buf = p;
786
   deref_ptr: Directly dereferencing pointer c.
787    if (c->addr_text.len) {
788        p = ngx_snprintf(buf, len, ", client: %V", &c->addr_text);
789        len -= p - buf;
790        buf = p;
791    }
792
   CID 251610 (#1 of 1): Dereference before null check (REVERSE_INULL)check_after_deref: Null-checking c suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
793    if (c && c->listening && c->listening->addr_text.len) {
794        p = ngx_snprintf(buf, len, ", server: %V", &c->listening->addr_text);
795        /* len -= p - buf; */
796        buf = p;
797    }

…nd by Coverity

785    buf = p;
786
   deref_ptr: Directly dereferencing pointer c.
787    if (c->addr_text.len) {
788        p = ngx_snprintf(buf, len, ", client: %V", &c->addr_text);
789        len -= p - buf;
790        buf = p;
791    }
792
   CID 251610 (openresty#1 of 1): Dereference before null check (REVERSE_INULL)check_after_deref: Null-checking c suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
793    if (c && c->listening && c->listening->addr_text.len) {
794        p = ngx_snprintf(buf, len, ", server: %V", &c->listening->addr_text);
795        /* len -= p - buf; */
796        buf = p;
797    }
@spacewander spacewander changed the title src/ngx_stream_lua_timer.c: fix possible null pointer dereference found by Coverity chore: fix possible null pointer dereference found by Coverity Jan 12, 2021
@spacewander spacewander merged commit e9cfdc0 into openresty:master Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants