From: Martin Willi Date: Wed, 7 May 2014 10:55:30 +0000 (+0200) Subject: vici: Check if header has been received before processing an empty message X-Git-Tag: 5.2.0dr3~9^2~1 X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=commitdiff_plain;h=1e4ee168c80fdb9931190d511cb8bca604df8a7a vici: Check if header has been received before processing an empty message If do_read() returns with EWOULDBLOCK, we must ensure that we actually have processed the full length header before checking the zero-initialized buffer length. --- diff --git a/src/libcharon/plugins/vici/vici_socket.c b/src/libcharon/plugins/vici/vici_socket.c index 05c2374..9167728 100644 --- a/src/libcharon/plugins/vici/vici_socket.c +++ b/src/libcharon/plugins/vici/vici_socket.c @@ -514,7 +514,8 @@ CALLBACK(on_read, bool, { disconnect(this, entry->id); } - else if (entry->in.buf.len == entry->in.done) + else if (entry->in.hdrlen == sizeof(entry->in.hdr) && + entry->in.buf.len == entry->in.done) { array_insert(entry->queue, ARRAY_TAIL, &entry->in.buf); entry->in.buf = chunk_empty;