Fix Crypto/utils.cpp: extract_file_name

This commit is contained in:
Eladash 2020-03-04 22:39:50 +02:00 committed by Ivan
parent 21b6495aaa
commit 39eafc1f3b
1 changed files with 6 additions and 1 deletions

View File

@ -147,7 +147,12 @@ void cmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, int in_
char* extract_file_name(const char* file_path, char real_file_name[MAX_PATH])
{
std::string_view v(file_path);
v = v.substr(0, v.find_last_of("/\\"));
if (auto pos = v.find_last_of("/\\"); pos != umax)
{
v.remove_prefix(pos + 1);
}
gsl::span r(real_file_name, MAX_PATH);
strcpy_trunc(r, v);
return real_file_name;