]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Rework the argv and env string fetching for execve to be more robust.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 20 Aug 2015 14:33:30 +0000 (14:33 +0000)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 20 Aug 2015 14:33:30 +0000 (14:33 +0000)
commit890843c15b84b40f8e6fdce6a7e07a087f66418c
tree5577fe5b1d9e5a6495688b8baaf8afe3a31d66fc
parent4a0589d1ba7b8738639f5d9f6ef585531c1990f4
Rework the argv and env string fetching for execve to be more robust.
Before truss would fetch 100 string pointers and happily walk off the end
of the array if it never found a NULL.  This also means for a short argv
list it could fail entirely if the 100 string pointers spanned into an
unmapped page.

Instead, fetch page-aligned blocks of string pointers in a loop fetching
each string until a NULL is found.

While here, make use of the open memstream file descriptor instead of
allocating a temporary array.  This allows us to fetch each string once
instead of twice.
usr.bin/truss/syscalls.c