From 791edf10677b534e9065b85d6a9fd1fc10d4e66f Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Fri, 4 Nov 2016 13:45:44 +0100 Subject: [PATCH] rgw: fix error handling in RGWPostObj_ObjStore::read_with_boundary. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_rest.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 666cac2f963..572b58aa9b9 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -1362,6 +1362,9 @@ int RGWPostObj_ObjStore::read_with_boundary(ceph::bufferlist& bl, bufferptr bp(need_to_read); const auto read_len = recv_body(s, bp.c_str(), need_to_read); + if (read_len < 0) { + return read_len; + } in_data.append(bp, 0, read_len); } @@ -1390,7 +1393,10 @@ int RGWPostObj_ObjStore::read_with_boundary(ceph::bufferlist& bl, if (left < skip + 2) { int need = skip + 2 - left; bufferptr boundary_bp(need); - recv_body(s, boundary_bp.c_str(), need); + const int r = recv_body(s, boundary_bp.c_str(), need); + if (r < 0) { + return r; + } in_data.append(boundary_bp); } max += skip; // skip boundary for next time -- 2.47.3