From 3efe5c6b5730079438efe4544a609b5204c2bf77 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 19 Mar 2015 12:16:53 +0200 Subject: [PATCH] Fixed possible null pointer dereference. --- server/core/buffer.c | 2 ++ server/modules/filter/tee.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/server/core/buffer.c b/server/core/buffer.c index 6f9a162be..fa2fa8d13 100644 --- a/server/core/buffer.c +++ b/server/core/buffer.c @@ -638,6 +638,8 @@ GWBUF *newbuf; char *ptr; int len; + if(orig == NULL) + return NULL; if (orig->next == NULL) return orig; diff --git a/server/modules/filter/tee.c b/server/modules/filter/tee.c index 02eca9943..8ea2dcc00 100644 --- a/server/modules/filter/tee.c +++ b/server/modules/filter/tee.c @@ -1081,6 +1081,16 @@ clientReply (FILTER* instance, void *session, GWBUF *reply) my_session->tee_partials[branch] = gwbuf_append(my_session->tee_partials[branch], reply); my_session->tee_partials[branch] = gwbuf_make_contiguous(my_session->tee_partials[branch]); complete = modutil_get_complete_packets(&my_session->tee_partials[branch]); + + if(complete == NULL) + { + /** Incomplete packet */ + skygw_log_write(LOGFILE_DEBUG,"tee.c: Incomplete packet, " + "waiting for a complete packet before forwarding."); + rc = 1; + goto retblock; + } + complete = gwbuf_make_contiguous(complete); if(my_session->tee_partials[branch] &&