From 25fb6515663f7541704d15068de280702e428042 Mon Sep 17 00:00:00 2001 From: Duncan Lowther Date: Thu, 8 Jun 2023 16:22:17 +0100 Subject: [PATCH] lib/oofatfs: Fix speculative read in create_name. Signed-off-by: Duncan Lowther --- lib/oofatfs/ff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oofatfs/ff.c b/lib/oofatfs/ff.c index 0c9d04fe7..eca5b45bd 100644 --- a/lib/oofatfs/ff.c +++ b/lib/oofatfs/ff.c @@ -2821,7 +2821,7 @@ static FRESULT create_name ( /* FR_OK: successful, FR_INVALID_NAME: could not if (di >= FF_MAX_LFN) return FR_INVALID_NAME; /* Reject too long name */ lfn[di++] = wc; /* Store the Unicode character */ } - while (*p == '/' || *p == '\\') p++; /* Skip duplicated separators if exist */ + if (wc == '/' || wc == '\\') while (*p == '/' || *p == '\\') p++; /* Skip duplicated separators if exist */ *path = p; /* Return pointer to the next segment */ cf = (wc < ' ') ? NS_LAST : 0; /* Set last segment flag if end of the path */