From a0f94f852608c7335b63c800cb2c14ec48980fa1 Mon Sep 17 00:00:00 2001 From: hw_llm Date: Fri, 7 Feb 2025 16:51:12 +0800 Subject: [PATCH] =?UTF-8?q?Description:=20los=20hilog=20=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E6=95=B4=E6=95=B0=E6=BA=A2=E5=87=BA=E9=A3=8E=E9=99=A9=20IssueN?= =?UTF-8?q?o:=20https://gitee.com/openharmony/kernel=5Fliteos=5Fa/issues/I?= =?UTF-8?q?BKPCV=3Ffrom=3Dproject-issue=20Feature=20Or=20Bugfix:=20Bugfix?= =?UTF-8?q?=20Binary=20Source:=20No=20Signed-off-by:=20hw=5Fllm=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/extended/hilog/los_hilog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/extended/hilog/los_hilog.c b/kernel/extended/hilog/los_hilog.c index 8ad4eb27..532c2547 100644 --- a/kernel/extended/hilog/los_hilog.c +++ b/kernel/extended/hilog/los_hilog.c @@ -321,8 +321,9 @@ out: static ssize_t HiLogWrite(struct file *filep, const char *buffer, size_t bufLen) { (void)filep; - if (bufLen + sizeof(struct HiLogEntry) > HILOG_BUFFER) { - PRINTK("input too large\n"); + size_t totalBufLen = bufLen + sizeof(struct HiLogEntry); + if ((totalBufLen < bufLen) || (totalBufLen > HILOG_BUFFER)) { + PRINTK("input bufLen %lld too large\n", bufLen); return -ENOMEM; } -- Gitee