On Wed, Jun 28, 2017 at 09:40:00AM +0800, JingPiao Chen wrote:
> * nlattr.h (nla_decoder_t): New typedef.
> (DECL_NLA): New macro.
> (decode_nlattr): Add decoders, size and opaque_data argument.
> * nlattr.c: (decode_nlattr_with_data): Likewise.
> (decode_nla_*): New functions.
> * netlink_sock_diag.c (decode_inet_diag_req_compat)
> (decode_inet_diag_req_v2, decode_inet_diag_msg)
> (decode_netlink_diag_msg, (decode_packet_diag_msg)
> (decode_smc_diag_msg, decode_unix_diag_msg): Add decoders,
> size and opaque_data arguments. All callers updated.
[...]
> @@ -76,7 +80,13 @@ decode_nlattr_with_data(struct tcb *tcp,
>  
>       if (nla_len > NLA_HDRLEN) {
>               tprints(", ");
> -             printstrn(tcp, addr + NLA_HDRLEN, nla_len - NLA_HDRLEN);
> +             if (!decoders
> +                 || nla->nla_type >= size
> +                 || !decoders[nla->nla_type]
> +                 || !decoders[nla->nla_type](tcp, addr + NLA_HDRLEN,
> +                                             nla_len - NLA_HDRLEN,
> +                                             opaque_data))
> +                     printstrn(tcp, addr + NLA_HDRLEN, len - NLA_HDRLEN);

Why printstrn(tcp, addr + NLA_HDRLEN, nla_len - NLA_HDRLEN) was changed
to  printstrn(tcp, addr + NLA_HDRLEN, len - NLA_HDRLEN) here?

Fixed and added a test case for this bug.


-- 
ldv

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to