]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: avoid string::front() on empty path 32596/head
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 10 Jan 2020 14:41:53 +0000 (09:41 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 10 Jan 2020 20:11:00 +0000 (15:11 -0500)
Fixes: https://tracker.ceph.com/issues/43548
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.h

index 4b56f9a358ab9b4ff9987e22cab279dd5df27b0f..026e70f585bfdd50001535cb4476f5925f341976 100644 (file)
@@ -510,7 +510,8 @@ namespace rgw {
        if (pos > 1) {
          path += "/";
        } else {
-         if (!omit_bucket && (path.front() != '/')) // pretty-print
+         if (!omit_bucket &&
+             ((path.length() == 0) || (path.front() != '/')))
            path += "/";
        }
        path += *s;