From 162a0410779f4fb49765d07d21da0e685ca14e96 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Mon, 29 Jun 2026 16:16:51 +0200 Subject: [PATCH] cmsfs-fuse: Fix strip_right() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit strip_right() strips spaces beginning at the end of the string moving to the beginning. However, it doesn't check whether it's at beginning of the array, and would continue reading if the string only contains spaces. Fix this by adding the necessary check. Signed-off-by: Sven Schnelle Reviewed-by: Mete Durlu Signed-off-by: Jan Höppner --- cmsfs-fuse/cmsfs-fuse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmsfs-fuse/cmsfs-fuse.c b/cmsfs-fuse/cmsfs-fuse.c index a6e0d4f1..5179287f 100644 --- a/cmsfs-fuse/cmsfs-fuse.c +++ b/cmsfs-fuse/cmsfs-fuse.c @@ -713,7 +713,7 @@ static int readdir_entry(struct fst_entry *fst, off_t addr) */ static inline int strip_right(const char *str, int size) { - while (str[size - 1] == 0x20) + while (size > 0 && str[size - 1] == 0x20) size--; return size; }