From 3bed89aa7456d9fe30e550cb5e21f8911036695b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 5 Sep 2014 14:01:13 -0400 Subject: [PATCH] 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. --- src/conf/fpathconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.25.1