From 7d2fd01c2d7d6d4c653a307a1419bc094f5332f0 Mon Sep 17 00:00:00 2001 From: arvinzzz Date: Wed, 23 Mar 2022 14:37:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=91=8A=E8=AD=A6=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: arvinzzz Change-Id: Iccf2fa30b1c16148c8c3e548fcdceda07dff8ae5 --- components/fs/vfs/los_fs.c | 4 ++++ kernel/src/los_queue.c | 1 + 2 files changed, 5 insertions(+) diff --git a/components/fs/vfs/los_fs.c b/components/fs/vfs/los_fs.c index 5fb95380..13c5f94c 100644 --- a/components/fs/vfs/los_fs.c +++ b/components/fs/vfs/los_fs.c @@ -269,6 +269,10 @@ int LOS_Open(const char *path, int oflag, ...) } size_t pathLen = strlen(path) + 1; + if ((unsigned)pathLen > PATH_MAX) { + errno = EINVAL; + return FS_FAILURE; + } char *canonicalPath = (char *)malloc(pathLen); if (!canonicalPath) { errno = ENOMEM; diff --git a/kernel/src/los_queue.c b/kernel/src/los_queue.c index 686e5d14..785b2316 100644 --- a/kernel/src/los_queue.c +++ b/kernel/src/los_queue.c @@ -39,6 +39,7 @@ #include "los_memory.h" #include "los_task.h" #include "los_sched.h" +#include #if (LOSCFG_BASE_IPC_QUEUE == 1)