From 4238396058d8d0af6452720cb78a4f06c4898e52 Mon Sep 17 00:00:00 2001 From: arvinzzz Date: Sat, 18 Dec 2021 18:52:30 +0800 Subject: [PATCH] =?UTF-8?q?fixed=206ee8e14=20from=20https://gitee.com/arvi?= =?UTF-8?q?nzzz/third=5Fparty=5Fmusl/pulls/177=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?fopen=E5=85=A5=E5=8F=82=E6=A3=80=E9=AA=8C=E4=B8=8D=E5=85=A8?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E8=AE=BF=E9=97=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当mode入参为空也做错误返回 close: #I4N0WY Signed-off-by: arvinzzz Change-Id: I0b0b997b6498b53da6324ea60d2502c3d2e80be3 --- porting/liteos_m/kernel/src/stdio/fopen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/porting/liteos_m/kernel/src/stdio/fopen.c b/porting/liteos_m/kernel/src/stdio/fopen.c index 7dddf930..56086846 100644 --- a/porting/liteos_m/kernel/src/stdio/fopen.c +++ b/porting/liteos_m/kernel/src/stdio/fopen.c @@ -12,7 +12,7 @@ FILE *fopen(const char *restrict filename, const char *restrict mode) int flags; /* Check for valid initial mode character */ - if (!strchr("rwa", *mode)) { + if ((mode == NULL) || (!strchr("rwa", *mode))) { errno = EINVAL; return 0; } -- GitLab