From 27ce372c37fad8f3cc9cc62571d3d300f9869cee Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 31 Jan 2017 01:46:34 -0600 Subject: 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. --- toys/posix/ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. -- cgit v1.2.3