From 31074502816436da08de031292103829abca8615 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 18 Jun 2014 00:50:27 +1000 Subject: [PATCH] recv_unix_msg can return a dud buffer on select failure --- src/libckpool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libckpool.c b/src/libckpool.c index 075c994c..34103d4f 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -672,13 +672,12 @@ char *_recv_unix_msg(int sockd, const char *file, const char *func, const int li LOGWARNING("Invalid message length zero sent to recv_unix_msg"); goto out; } - buf = ckalloc(msglen + 1); - buf[msglen] = 0; ret = wait_read_select(sockd, 5); if (unlikely(ret < 1)) { LOGERR("Select2 failed in recv_unix_msg"); goto out; } + buf = ckzalloc(msglen + 1); ret = read_length(sockd, buf, msglen); if (unlikely(ret < (int)msglen)) { LOGERR("Failed to read %d bytes in recv_unix_msg", msglen);