提交 a755bb56 编写于 作者: O openharmony_ci 提交者: Gitee

!177 fix:fopen入参校验不全导致访问异常

Merge pull request !177 from Zhaotianyu/1218fopen_fix
...@@ -12,7 +12,7 @@ FILE *fopen(const char *restrict filename, const char *restrict mode) ...@@ -12,7 +12,7 @@ FILE *fopen(const char *restrict filename, const char *restrict mode)
int flags; int flags;
/* Check for valid initial mode character */ /* Check for valid initial mode character */
if (!strchr("rwa", *mode)) { if ((mode == NULL) || (!strchr("rwa", *mode))) {
errno = EINVAL; errno = EINVAL;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册