[git commit] pstree: stop truncating thread names

Mike Frysinger vapier at gentoo.org
Fri Jun 28 00:35:13 UTC 2013


On Thursday 27 June 2013 19:55:32 Denys Vlasenko wrote:
> On Wednesday 19 June 2013 17:29, Mike Frysinger wrote:
> >  static void handle_thread(const char *comm, pid_t pid, pid_t ppid, uid_t
> >  uid) {
> > 
> > -	char threadname[COMM_LEN + 2];
> > -	sprintf(threadname, "{%.*s}", COMM_LEN - 2, comm);
> > +	char threadname[COMM_DISP_LEN + 1];
> > +	sprintf(threadname, "{%.*s}", (int)sizeof(threadname) - 1, comm);
> 
> ??
> 
> The size should be (int)sizeof(threadname) - 3

yeah, i was thinking about the NUL.  well, fixed one bug by adding another :).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130627/fe8a4dff/attachment-0001.asc>


More information about the busybox mailing list