kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 7cf0006f52a047a2d9b6f340bf642e0b6c031d6b
parent ff2d961be761e17477a1dc9067ae784022565750
Author: Joris Vink <joris@coders.se>
Date:   Wed, 13 Nov 2019 11:23:02 +0100

fix potential NULL dereferences.

found by clang --analyze, reminded by fahlgren@

Diffstat:
src/http.c | 2+-
src/worker.c | 2++
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/http.c b/src/http.c @@ -1991,7 +1991,7 @@ http_response_normal(struct http_request *req, struct connection *c, kore_buf_append(header_buf, http_version, http_version_len); if ((c->flags & CONN_CLOSE_EMPTY) || - (req->flags & HTTP_VERSION_1_0)) { + (req != NULL && (req->flags & HTTP_VERSION_1_0))) { connection_close = 1; } else { connection_close = 0; diff --git a/src/worker.c b/src/worker.c @@ -627,6 +627,8 @@ kore_worker_keymgr_response_verify(struct kore_msg *msg, const void *data, if (out == NULL) return (KORE_RESULT_OK); + dom = NULL; + LIST_FOREACH(srv, &kore_servers, list) { dom = NULL;