]> granicus.if.org Git - strace/commit
printpath: do not fetch more than PATH_MAX bytes from tracee's memory
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 1 Aug 2017 20:59:48 +0000 (20:59 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 1 Aug 2017 20:59:48 +0000 (20:59 +0000)
commitd7a45f8dcce557f1c7b876dd22af8f2e7daf1bb1
tree93e01df983bfe15d3d79fb83f2ab884cfea4fd15
parentce822389af4a7556e665ba8f445dcd6a0e495b6d
printpath: do not fetch more than PATH_MAX bytes from tracee's memory

The kernel does not copy more than PATH_MAX bytes from userspace
pathnames, treating non-NUL-terminated pathnames as ENAMETOOLONG.

* util.c (printpathn): Decrease buffer size to PATH_MAX.
(printpath): Specify PATH_MAX - 1 as the maximum pathname length
to match the kernel behaviour.  The underlying umovestr call will fetch
up to PATH_MAX bytes from tracee's memory, but no more than first
PATH_MAX - 1 bytes will be printed.
util.c