Skip to content

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

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

734    buf = p;
735
   deref_ptr: Directly dereferencing pointer c.
736    if (c->addr_text.len) {
737        p = ngx_snprintf(buf, len, ", client: %V", &c->addr_text);
738        len -= p - buf;
739        buf = p;
740    }
741
   CID 149839 (#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.
742    if (c && c->listening && c->listening->addr_text.len) {
743        p = ngx_snprintf(buf, len, ", server: %V", &c->listening->addr_text);
744        /* len -= p - buf; */
745        buf = p;
746    }

I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.

… by Coverity

734    buf = p;
735
   deref_ptr: Directly dereferencing pointer c.
736    if (c->addr_text.len) {
737        p = ngx_snprintf(buf, len, ", client: %V", &c->addr_text);
738        len -= p - buf;
739        buf = p;
740    }
741
   CID 149839 (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.
742    if (c && c->listening && c->listening->addr_text.len) {
743        p = ngx_snprintf(buf, len, ", server: %V", &c->listening->addr_text);
744        /* len -= p - buf; */
745        buf = p;
746    }
@spacewander spacewander changed the title src/ngx_http_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 88a52c4 into openresty:master Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants