Skip to content

src/ngx_http_lua_ssl_certby.c: fix possible null pointer dereference found by coverity #1601

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
Dec 15, 2020

Conversation

chipitsine
Copy link
Contributor

@chipitsine chipitsine commented Sep 17, 2019

   deref_ptr: Directly dereferencing pointer c.
419    if (c->addr_text.len) {
420        p = ngx_snprintf(buf, len, ", client: %V", &c->addr_text);
421        len -= p - buf;
422        buf = p;
423    }
424
   CID 149837 (#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.
425    if (c && c->listening && c->listening->addr_text.len) {
426        p = ngx_snprintf(buf, len, ", server: %V", &c->listening->addr_text);
427        /* len -= p - buf; */
428        buf = p;
429    }

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

…found by coverity

   deref_ptr: Directly dereferencing pointer c.
419    if (c->addr_text.len) {
420        p = ngx_snprintf(buf, len, ", client: %V", &c->addr_text);
421        len -= p - buf;
422        buf = p;
423    }
424
   CID 149837 (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.
425    if (c && c->listening && c->listening->addr_text.len) {
426        p = ngx_snprintf(buf, len, ", server: %V", &c->listening->addr_text);
427        /* len -= p - buf; */
428        buf = p;
429    }
@rainingmaster rainingmaster merged commit 138c1b9 into openresty:master Dec 15, 2020
@chipitsine chipitsine deleted the coverity branch December 15, 2020 09:42
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.

3 participants