diff options
author | Martin Willi <martin@revosec.ch> | 2014-05-07 12:55:30 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-05-07 14:13:39 +0200 |
commit | 1e4ee168c80fdb9931190d511cb8bca604df8a7a (patch) | |
tree | d1913021d1903795903c0cf98a3e10846102a32d /src/libcharon/plugins/vici/vici_socket.c | |
parent | afb7ef49087f26bb73d4e07402e9bdeb62ccfda1 (diff) | |
download | strongswan-1e4ee168c80fdb9931190d511cb8bca604df8a7a.tar.bz2 strongswan-1e4ee168c80fdb9931190d511cb8bca604df8a7a.tar.xz |
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.
Diffstat (limited to 'src/libcharon/plugins/vici/vici_socket.c')
-rw-r--r-- | src/libcharon/plugins/vici/vici_socket.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libcharon/plugins/vici/vici_socket.c b/src/libcharon/plugins/vici/vici_socket.c index 05c237497..916772871 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; |