!36 公共基础库代码优化

Merge pull request !36 from liubb/master
This commit is contained in:
openharmony_ci
2020-10-10 10:20:20 +08:00
committed by Gitee
3 changed files with 5 additions and 5 deletions
+3
View File
@@ -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;
}
+1 -4
View File
@@ -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