]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: fix buffer overflow for aio_exec python binding 22707/head
authorAleksei Gutikov <aleksey.gutikov@synesis.ru>
Thu, 3 May 2018 16:20:40 +0000 (19:20 +0300)
committerPrashant D <pdhange@redhat.com>
Tue, 26 Jun 2018 03:35:23 +0000 (23:35 -0400)
aio_exec returns ERANGE if provided buffer is not enough.

Fixes: https://tracker.ceph.com/issues/23964
Signed-off-by: Aleksei Gutikov <aleksey.gutikov@synesis.ru>
(cherry picked from commit 2ac2592e1d5548b40f7311840360968040614208)

src/librados/IoCtxImpl.cc

index cc8d7a27ead31212819d8b3e852c4ec32b1fbc20..3dbc8235bbe411c2f80b718fde2748708bd23044 100644 (file)
@@ -2017,9 +2017,11 @@ void librados::IoCtxImpl::C_aio_Complete::finish(int r)
   c->cond.Signal();
 
   if (r == 0 && c->blp && c->blp->length() > 0) {
-    if (c->out_buf && !c->blp->is_provided_buffer(c->out_buf))
-      c->blp->copy(0, c->blp->length(), c->out_buf);
-    c->rval = c->blp->length();
+    if (c->out_buf && !c->blp->is_contiguous()) {
+      c->rval = -ERANGE;
+    } else {
+      c->rval = c->blp->length();
+    }
   }
 
   if (c->callback_complete ||