From cdf4ffedd2e990ae0a029056d1b4d0030495b95f Mon Sep 17 00:00:00 2001 From: l00520400 Date: Mon, 14 Mar 2022 16:18:10 +0800 Subject: [PATCH] Signed-off-by: l00520400 Change-Id: If17ccfe0ca38691abba501936f0cf6961d05300d --- interfaces/innerkits/nativetoken/src/nativetoken.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interfaces/innerkits/nativetoken/src/nativetoken.c b/interfaces/innerkits/nativetoken/src/nativetoken.c index 8a5c12017..ad1e6207f 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; -- Gitee