]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: NObjectIteratorImpl takes care about NUL in obj name.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 4 Feb 2021 17:35:24 +0000 (17:35 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 5 Feb 2021 12:54:22 +0000 (12:54 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/librados/librados_cxx.cc

index 9557f118548939b877606a7da1502883dce293bd..b38afc0164439e09ba7ed75d2bf20142077596b8 100644 (file)
@@ -850,22 +850,24 @@ void librados::NObjectIteratorImpl::set_filter(const bufferlist &bl)
 void librados::NObjectIteratorImpl::get_next()
 {
   const char *entry, *key, *nspace;
+  size_t entry_size, key_size, nspace_size;
   if (ctx->nlc->at_end())
     return;
-  int ret = rados_nobjects_list_next(ctx.get(), &entry, &key, &nspace);
+  int ret = rados_nobjects_list_next2(ctx.get(), &entry, &key, &nspace,
+                                      &entry_size, &key_size, &nspace_size);
   if (ret == -ENOENT) {
     return;
   }
   else if (ret) {
     throw std::system_error(-ret, std::system_category(),
-                            "rados_nobjects_list_next");
+                            "rados_nobjects_list_next2");
   }
 
   if (cur_obj.impl == NULL)
     cur_obj.impl = new ListObjectImpl();
-  cur_obj.impl->nspace = nspace;
-  cur_obj.impl->oid = entry;
-  cur_obj.impl->locator = key ? key : string();
+  cur_obj.impl->nspace = string{nspace, nspace_size};
+  cur_obj.impl->oid = string{entry, entry_size};
+  cur_obj.impl->locator = key ? string(key, key_size) : string();
 }
 
 uint32_t librados::NObjectIteratorImpl::get_pg_hash_position() const