SCP: Fix file name parser to tolerate a name without any slashes in the path

This commit is contained in:
Mark Pizzolato 2020-02-17 21:03:20 -08:00
parent a2300fcf95
commit 7e58080fb5

View file

@ -809,7 +809,10 @@ while ((c = strstr (fullpath, "/../"))) { /* process up directory climbing
else else
break; break;
} }
name = 1 + strrchr (fullpath, '/'); if (!strrchr (fullpath, '/'))
name = fullpath + strlen (fullpath);
else
name = 1 + strrchr (fullpath, '/');
ext = strrchr (name, '.'); ext = strrchr (name, '.');
if (ext == NULL) if (ext == NULL)
ext = name + strlen (name); ext = name + strlen (name);