rgw: off-by-one in rgw_trim_whitespace()

Fixes: #7543
Backport: dumpling

Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
Signed-off-by: Ray Lv <raylv@yahoo-inc.com>
(cherry picked from commit 195d53a7fc695ed954c85022fef6d2a18f68fe20)