commit 5b16e8a4eb5075155ff87ec5595abeb705a6aab4
parent f26a1449bfa18a6fbbe263f084df4e490772e9d3
Author: Mattias Andrée <maandree@kth.se>
Date: Sat, 26 Mar 2016 15:46:29 +0100
pwdx: fix off-by-one bug
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pwdx.c b/pwdx.c
@@ -31,7 +31,7 @@ main(int argc, char *argv[])
for (; argc > 0; argc--, argv++) {
n = snprintf(path, sizeof(path), "/proc/%s/cwd", *argv);
- if (n < 0 || n > sizeof(path)) {
+ if (n < 0 || n >= sizeof(path)) {
errno = ESRCH;
} else {
n = readlink(path, target, sizeof(target) - 1);