提交 3bed89aa 编写于 作者: R Rich Felker

fix off-by-one in bounds check in fpathconf

this error resulted in an out-of-bounds read, as opposed to a reported
error, when calling the function with an argument one greater than the
max valid index.
上级 633183b5
......@@ -27,7 +27,7 @@ long fpathconf(int fd, int name)
[_PC_SYMLINK_MAX] = SYMLINK_MAX,
[_PC_2_SYMLINKS] = 1
};
if (name > sizeof(values)/sizeof(values[0])) {
if (name >= sizeof(values)/sizeof(values[0])) {
errno = EINVAL;
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册