From 7e58080fb5333080235558e732381966687aa758 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 17 Feb 2020 21:03:20 -0800 Subject: [PATCH] SCP: Fix file name parser to tolerate a name without any slashes in the path --- sim_fio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sim_fio.c b/sim_fio.c index 44ccea44..eb97b9eb 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -809,7 +809,10 @@ while ((c = strstr (fullpath, "/../"))) { /* process up directory climbing else break; } -name = 1 + strrchr (fullpath, '/'); +if (!strrchr (fullpath, '/')) + name = fullpath + strlen (fullpath); +else + name = 1 + strrchr (fullpath, '/'); ext = strrchr (name, '.'); if (ext == NULL) ext = name + strlen (name);