From: Rich Felker Date: Fri, 5 Sep 2014 18:01:13 +0000 (-0400) Subject: fix off-by-one in bounds check in fpathconf X-Git-Tag: v1.1.5~36 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3bed89aa7456d9fe30e550cb5e21f8911036695b;p=oweals%2Fmusl.git 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. --- diff --git a/src/conf/fpathconf.c b/src/conf/fpathconf.c index 28c4345c..8eb037e6 100644 --- a/src/conf/fpathconf.c +++ b/src/conf/fpathconf.c @@ -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; }