about summary refs log tree commit diff
path: root/src/conf
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-09-05 14:01:13 -0400
committerRich Felker <dalias@aerifal.cx>2014-09-05 14:01:13 -0400
commit3bed89aa7456d9fe30e550cb5e21f8911036695b (patch)
tree4cb9f47d5d2fdec6409a259ec8a18a455ea7efc4 /src/conf
parent633183b5d1c298e4335da841926efe96252057b3 (diff)
downloadmusl-3bed89aa7456d9fe30e550cb5e21f8911036695b.tar.gz
musl-3bed89aa7456d9fe30e550cb5e21f8911036695b.tar.xz
musl-3bed89aa7456d9fe30e550cb5e21f8911036695b.zip
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.
Diffstat (limited to 'src/conf')
-rw-r--r--src/conf/fpathconf.c2
1 files changed, 1 insertions, 1 deletions
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;
 	}