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.
This commit is contained in:
Martin Willi
2014-05-07 14:13:39 +02:00
parent afb7ef4908
commit 1e4ee168c8
+2 -1
View File
@@ -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;