From: Denys Vlasenko Date: Thu, 27 Jun 2013 23:59:25 +0000 (+0200) Subject: pstree: fix theoretically unsafe code X-Git-Tag: 1.22.1~172 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=173aa78bcf68c2a036823bdee803b35820ddcd44;p=platform%2Fupstream%2Fbusybox.git pstree: fix theoretically unsafe code In practice, p->comm is never long enough to trigger the bug, but still. Signed-off-by: Denys Vlasenko --- 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