From cfcdba4ae2995ac9d188c60c26e606f18b0bc758 Mon Sep 17 00:00:00 2001 From: Nathan French Date: Mon, 31 Jul 2017 15:51:11 -0700 Subject: [PATCH] [Issue#25] Return NULL if callbacks == NULL for get_cb --- evhtp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/evhtp.c b/evhtp.c index 0baad4f..98d5ab6 100644 --- a/evhtp.c +++ b/evhtp.c @@ -4214,6 +4214,12 @@ evhtp_get_cb(evhtp_t * htp, const char * path) { evhtp_callback_t * callback; + evhtp_assert(htp != NULL); + + if (evhtp_unlikely(htp->callbacks == NULL)) { + return NULL; + } + TAILQ_FOREACH(callback, htp->callbacks, next) { if (strcmp(callback->val.path, path) == 0)