From d0da28c32651102cc71d755f926c67dc6eb78eee Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 23 May 2017 12:13:58 +1000 Subject: [PATCH] Handle invalidated connsock being sent to read_socket_line. --- src/ckpool.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 2982a62c..d3e71b4b 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -610,12 +610,20 @@ static int recv_available(ckpool_t *ckp, connsock_t *cs) * and -1 on error. */ int read_socket_line(connsock_t *cs, float *timeout) { - ckpool_t *ckp = cs->ckp; - bool quiet = ckp->proxy | ckp->remote; char *eom = NULL; tv_t start, now; + ckpool_t *ckp; + int ret = -1; + bool quiet; float diff; - int ret; + + if (unlikely(!cs)) { + LOGNOTICE("Invalidated connsock sent to read_socket_line"); + return ret; + } + + ckp = cs->ckp; + quiet = ckp->proxy | ckp->remote; clear_bufline(cs); recv_available(ckp, cs); // Intentionally ignore return value