]> granicus.if.org Git - strace/commit
Fix decoding of struct msghdr.msg_name* arguments of recvmsg syscall
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 13 Jul 2016 21:56:16 +0000 (21:56 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 13 Jul 2016 21:56:16 +0000 (21:56 +0000)
commitd8f77cdf42bf7215e7e7615b617a1de3d01188fd
treeb695b95222c6beda89bc96fc6bb61507d8e66769
parent766e1d992832aa9deca9aac6666916e98b3ae866
Fix decoding of struct msghdr.msg_name* arguments of recvmsg syscall

As the msghdr.msg_namelen argument of recvmsg syscall has the same
read-write semantics as the address length argument of recvfrom syscall,
parser of recvmsg syscall needs a similar fix.

* defs.h (fetch_msghdr_namelen): New prototype.
(decode_msghdr): Add "int *" argument.
* msghdr.c (print_msghdr): Likewise.  Treat it as a pointer to struct
msghdr.msg_namelen passed to the kernel.  Pass to decode_sockaddr
the size of socket address actually returned by the kernel.
Print both user and kernel address lengths when the value changes.
(decode_msghdr, decode_mmsghdr): Add "int *" argument,
forward it to print_msghdr.
(decode_mmsgvec): Update decode_mmsghdr invocation.
(fetch_msghdr_namelen): New function.
* net.c (SYS_FUNC(sendmsg)): Update decode_msghdr invocation.
(SYS_FUNC(recvmsg)): Use fetch_msghdr_namelen on entering to save
struct msghdr.msg_namelen.  On exiting, pass the saved value
to decode_msghdr.
defs.h
msghdr.c
net.c