From 7ad65d078e132d1a6134581520107d0b383fae89 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Thu, 22 May 2014 11:09:52 +0400 Subject: [PATCH] Iproto padding check: we must check for length after all. Check for length, since otherwise the server would randomly drop client connection once in a while. --- src/iproto.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/iproto.cc b/src/iproto.cc index 8f0802492e..8771d86816 100644 --- a/src/iproto.cc +++ b/src/iproto.cc @@ -477,9 +477,10 @@ iproto_enqueue_batch(struct iproto_connection *con, struct ibuf *in) break; uint32_t len = mp_decode_uint(&pos); /* Skip optional request padding. */ - if (mp_typeof(*pos) == MP_STR && mp_check(&pos, in->end)) + if (pos < in->end && mp_typeof(*pos) == MP_STR && + mp_check(&pos, in->end)) { goto error; - + } const char *reqend = pos + len; if (reqend > in->end) break; -- GitLab