From 2136b9873cdfe3440eed19423b9675c6a8b93f03 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Fri, 10 Jan 2020 09:41:53 -0500 Subject: [PATCH] rgw_file: avoid string::front() on empty path Fixes: https://tracker.ceph.com/issues/43548 Signed-off-by: Matt Benjamin --- src/rgw/rgw_file.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 4b56f9a358ab9..026e70f585bfd 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; -- 2.39.5