diff --git a/interfaces/innerkits/nativetoken/src/nativetoken.c b/interfaces/innerkits/nativetoken/src/nativetoken.c index 8a5c12017340b6a915b0e9b2415c4d8b4330aeb0..ad1e6207f91de6f0ccbe51ac55245eb26138a951 100644 --- a/interfaces/innerkits/nativetoken/src/nativetoken.c +++ b/interfaces/innerkits/nativetoken/src/nativetoken.c @@ -38,6 +38,11 @@ int32_t GetFileBuff(const char *cfg, char **retBuff) return ATRET_FAILED; } + if (fileStat.st_size == 0) { + *retBuff = NULL; + return ATRET_SUCCESS; + } + if (fileStat.st_size > MAX_JSON_FILE_LEN) { ACCESSTOKEN_LOG_ERROR("[ATLIB-%s]:stat file size is invalid.", __func__); return ATRET_FAILED;