From: Matt Benjamin Date: Fri, 10 Jan 2020 14:41:53 +0000 (-0500) Subject: rgw_file: avoid string::front() on empty path X-Git-Tag: v14.2.8~17^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dad86a25d9416fef600cf9640957d12cff87dcba;p=ceph.git rgw_file: avoid string::front() on empty path Fixes: https://tracker.ceph.com/issues/43548 Signed-off-by: Matt Benjamin (cherry picked from commit 2136b9873cdfe3440eed19423b9675c6a8b93f03) --- diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 84b17069e20..0bf488a579b 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -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;