pwdx: fix off-by-one bug

Signed-off-by: Mattias Andrée <maandree@kth.se>
This commit is contained in:
Mattias Andrée 2016-03-26 15:46:29 +01:00 committed by sin
parent f26a1449bf
commit 5b16e8a4eb
1 changed files with 1 additions and 1 deletions

2
pwdx.c
View File

@ -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);