]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't specify a length when convert bl -> string 15599/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Fri, 9 Jun 2017 13:27:25 +0000 (15:27 +0200)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 9 Jun 2017 13:36:11 +0000 (15:36 +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>
src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc

index 5a65eb5a5150824b639989b649ed69acf44275dc..5d8ecbd08868f91add78850cfcebe9f7b39a6170 100644 (file)
@@ -1243,7 +1243,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 7c6c98821aca8e110e9c7d3d5d918af54bb67770..36e2eafedaf6b586fb75d41134df2fe28211cfa5 100644 (file)
@@ -9000,8 +9000,8 @@ int RGWRados::get_system_obj_state_impl(RGWObjectCtx *rctx, rgw_raw_obj& obj, RG
   s->obj_tag = s->attrset[RGW_ATTR_ID_TAG];
 
   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;
 
@@ -9152,7 +9152,7 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket
     }
   }
   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;