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.
This commit is contained in:
parent
633183b5d1
commit
3bed89aa74
1 changed files with 1 additions and 1 deletions
|
|
@ -27,7 +27,7 @@ long fpathconf(int fd, int name)
|
||||||
[_PC_SYMLINK_MAX] = SYMLINK_MAX,
|
[_PC_SYMLINK_MAX] = SYMLINK_MAX,
|
||||||
[_PC_2_SYMLINKS] = 1
|
[_PC_2_SYMLINKS] = 1
|
||||||
};
|
};
|
||||||
if (name > sizeof(values)/sizeof(values[0])) {
|
if (name >= sizeof(values)/sizeof(values[0])) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue