mirror of
https://github.com/openharmony/utils_native_lite.git
synced 2026-07-19 14:33:34 -04:00
@@ -42,6 +42,9 @@ bool IsValidPath(const char* path)
|
||||
if ((strstr(path, "/./") != nullptr) || (strstr(path, "/../") != nullptr)) {
|
||||
return false;
|
||||
}
|
||||
if (strpbrk(path + PREFIX_LEN, "\"*+,:;<=>\?[]|\x7F")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,16 +39,13 @@ static bool IsValidPath(const char* path)
|
||||
if ((pathLen == 0) || (pathLen > FILE_NAME_MAX_LEN)) {
|
||||
return false;
|
||||
}
|
||||
if (strpbrk(path, "\"*+,:;<=>\?[]|\x7F")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int GetRealPath(const char* originPath, char* trustPath, size_t tPathLen)
|
||||
{
|
||||
#if (defined _WIN32 || defined _WIN64)
|
||||
if (PathCanonicalize(originPath, trustPath) == true) {
|
||||
if (PathCanonicalize(trustPath, originPath)) {
|
||||
return NATIVE_SUCCESS;
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -59,7 +59,7 @@ static int GetKvFolder(const char* dataPath)
|
||||
static int GetRealPath(const char* originPath, char* trustPath, size_t tPathLen)
|
||||
{
|
||||
#if (defined _WIN32 || defined _WIN64)
|
||||
if (PathCanonicalize(originPath, trustPath) == true) {
|
||||
if (PathCanonicalize(trustPath, originPath)) {
|
||||
return NATIVE_SUCCESS;
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user