From b38d5833fadf7e224e8234fd0dbb4d186b1d5368 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Tue, 30 Jun 2026 07:22:54 +0200 Subject: [PATCH] hmcdrvfs: Fix hmcdrv_path_copy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While iterating over the string, hmcdrv_path_copy() subtracts one byte of the length to account for the NUL byte, but fails to account for the '/' character it might add. Change the test to leave two bytes of room. Signed-off-by: Sven Schnelle Reviewed-by: Marc Hartmayer Reviewed-by: Mete Durlu Signed-off-by: Jan Höppner --- hmcdrvfs/hmcdrvfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hmcdrvfs/hmcdrvfs.c b/hmcdrvfs/hmcdrvfs.c index 73c34b77..05455fff 100644 --- a/hmcdrvfs/hmcdrvfs.c +++ b/hmcdrvfs/hmcdrvfs.c @@ -514,7 +514,7 @@ static int hmcdrv_path_copy(struct hmcdrv_fuse_file *fp, char *dest) char *src = HMCDRV_FUSE_PATH(fp); int len = 0; - while ((len < (HMCDRV_FUSE_MAXPATH - 1)) && + while ((len < (HMCDRV_FUSE_MAXPATH - 2)) && (*src != '\0')) { *dest = *src;