blob: b7da8c0d2a6b0e946d62f5cf13219c82c14dd48d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
From 3bed89aa7456d9fe30e550cb5e21f8911036695b Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
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 28c4345..8eb037e 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.3.3
|