]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't specify a length when convert bl -> string 17151/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 9 Jun 2017 13:27:25 +0000 (15:27 +0200)
committerNathan Cutler <ncutler@suse.com>
Tue, 22 Aug 2017 14:04:45 +0000 (16:04 +0200)
in rgw_admin we're assigning a string from a bufferlist by explicitly
specifying a size and using assign, in this case the whole contents of
the buffer are copied regardless of whether the null character is seen.
Just use normal assign which would only copy until the null is
encountered

Fixes: http://tracker.ceph.com/issues/20037
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit b38bda730dd9a0112024e9ecea95cd0d9c80d18f)

Conflicts:
src/rgw/rgw_rados.cc (trivial resolution)

src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc

index 60596e25507bd6a274634cb3472dc37bb99fb74a..531429580fb9622d061a9400b59dd715924ac6b1 100644 (file)
@@ -1058,7 +1058,7 @@ static bool dump_string(const char *field_name, bufferlist& bl, Formatter *f)
 {
   string val;
   if (bl.length() > 0) {
-    val.assign(bl.c_str(), bl.length());
+    val.assign(bl.c_str());
   }
   f->dump_string(field_name, val);
 
index fa01aa31d7448c485cad71e247a028b2e745df73..154f7682722d3450e3bb7ef41e47a9c0ca052408 100644 (file)
@@ -8138,7 +8138,7 @@ int RGWRados::get_system_obj_state_impl(RGWObjectCtx *rctx, rgw_obj& obj, RGWObj
 
   bufferlist manifest_bl = s->attrset[RGW_ATTR_MANIFEST];
   if (s->obj_tag.length())
-    ldout(cct, 20) << "get_system_obj_state: setting s->obj_tag to " << string(s->obj_tag.c_str(), s->obj_tag.length()) << dendl;
+    ldout(cct, 20) << "get_system_obj_state: setting s->obj_tag to " << s->obj_tag.c_str() << dendl;
   else
     ldout(cct, 20) << "get_system_obj_state: s->obj_tag was set empty" << dendl;
 
@@ -8258,7 +8258,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState *
     }
   }
   if (s->obj_tag.length())
-    ldout(cct, 20) << "get_obj_state: setting s->obj_tag to " << string(s->obj_tag.c_str(), s->obj_tag.length()) << dendl;
+    ldout(cct, 20) << "get_obj_state: setting s->obj_tag to " << s->obj_tag.c_str() << dendl;
   else
     ldout(cct, 20) << "get_obj_state: s->obj_tag was set empty" << dendl;