aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2017-01-31 01:46:34 -0600
committerRob Landley <rob@landley.net>2017-01-31 01:46:34 -0600
commit27ce372c37fad8f3cc9cc62571d3d300f9869cee (patch)
tree5ab7620acb51fdedf57ef371348d33306eef0ece
parent448853e0d858e1c9b57c4d2adccb5969bc822f62 (diff)
downloadtoybox-27ce372c37fad8f3cc9cc62571d3d300f9869cee.tar.gz
ps bugfix: len of TTY field doesn't include null terminator, so memmove should
subtract one _less_ than /dev prefix length or string isn't terminated.
-rw-r--r--toys/posix/ps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 6035bd80..cf1f11c6 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -810,7 +810,7 @@ static int get_ps(struct dirtree *new)
}
s = buf;
- if (strstart(&s, "/dev/")) memmove(buf, s, len -= 5);
+ if (strstart(&s, "/dev/")) memmove(buf, s, len -= 4);
}
// Data we want is in a file.