]> granicus.if.org Git - strace/commit
Fix recvmsg decode: do not show more data than actually returned
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 28 Apr 2012 12:26:18 +0000 (14:26 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 28 Apr 2012 12:26:18 +0000 (14:26 +0200)
commite0bc222263cf47a43e1b26d55edb2ffadc8ccbff
tree6c7f91e344fa5007eb8f2ea9e57e26b3a6e7d261
parent54432560a846a466341874c11c8400d4b00def1e
Fix recvmsg decode: do not show more data than actually returned

I noticed that "hostname -d" talks over netlink and gets 20 bytes
of response, but we show entire 1024 bytes of iov.
This changes fixes that.

* defs.h: New function tprint_iov_upto.
* io.c (tprint_iov_upto): Definition of this function.
(tprint_iov): Call tprint_iov_upto.
* net.c (do_msghdr): Add data_size parameter, pass it down to tprint_iov_upto.
(printmsghdr): Add data_size parameter, pass it down to do_msghdr.
(printmmsghdr): Call do_msghdr with data_size==ULONG_MAX.
(sys_sendmsg): Call printmsghdr with data_size==ULONG_MAX.
(sys_recvmsg): Call printmsghdr with data_size==tcp->u_rval.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
defs.h
io.c
net.c