提交 42383960 编写于 作者: A arvinzzz 提交者: Zhaotianyu

fixed 6ee8e141 from https://gitee.com/arvinzzz/third_party_musl/pulls/177

fix: 修复fopen入参检验不全导致访问异常

当mode入参为空也做错误返回

close: #I4N0WY
Signed-off-by: Narvinzzz <zhaotianyu9@huawei.com>
Change-Id: I0b0b997b6498b53da6324ea60d2502c3d2e80be3
上级 2a587359
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册