summaryrefslogtreecommitdiff
authorDenys Vlasenko <vda.linux@googlemail.com>2013-06-27 23:59:25 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2013-06-27 23:59:25 (GMT)
commit173aa78bcf68c2a036823bdee803b35820ddcd44 (patch)
treefe41b2b07189628aeeb29bbdef6b6e6aef090d17
parent26a7e2ecbf76db06cf0754a0664eaa68e3cae53a (diff)
downloadbusybox-173aa78bcf68c2a036823bdee803b35820ddcd44.zip
busybox-173aa78bcf68c2a036823bdee803b35820ddcd44.tar.gz
busybox-173aa78bcf68c2a036823bdee803b35820ddcd44.tar.bz2
pstree: fix theoretically unsafe code
In practice, p->comm is never long enough to trigger the bug, but still. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat
-rw-r--r--procps/pstree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/procps/pstree.c b/procps/pstree.c
index ea690a9..ed1a412 100644
--- a/procps/pstree.c
+++ b/procps/pstree.c
@@ -349,7 +349,7 @@ static void dump_by_user(PROC *current, uid_t uid)
static void handle_thread(const char *comm, pid_t pid, pid_t ppid, uid_t uid)
{
char threadname[COMM_DISP_LEN + 1];
- sprintf(threadname, "{%.*s}", (int)sizeof(threadname) - 1, comm);
+ sprintf(threadname, "{%.*s}", (int)sizeof(threadname) - 3, comm);
add_proc(threadname, pid, ppid, uid/*, 1*/);
}
#endif