On Tue, Jul 05, 2016 at 12:03:53PM +0000, Fabien Siron wrote:
> Quoting Dmitry V. Levin (2016-07-04 22:14:40)
> > On Wed, Jun 29, 2016 at 12:20:00PM +0000, Fabien Siron wrote:
[...]
> > > +void
> > > +decode_netlink(struct tcb *tcp, unsigned long addr, unsigned long 
> > > total_size) {
> > > +     struct nlmsghdr nlmsghdr;
> > > +     unsigned long elt, size = total_size;
> > > +     int print_array = 0;
> > > +
> > > +     for (elt = 0; fetch_nlmsg(tcp, &nlmsghdr, addr, size);
> > > +          addr = next_nlmsg(&nlmsghdr, addr, &size), elt++) {
> > > +             if (elt == max_strlen && abbrev(tcp)) {
> > > +                     tprints("...");
> > > +                     break;
> > > +             }
> > > +             if (nlmsghdr.nlmsg_len < sizeof(struct nlmsghdr))
> > > +                     break;
> > 
> > This edition of decode_netlink will print nothing if addr == NULL,
> > or if the first nlmsghdr.nlmsg_len < sizeof(struct nlmsghdr).
> 
> What should be printed in these cases?

If decode_netlink is called with addr == NULL, it should print
printaddr(addr); if nlmsghdr.nlmsg_len < sizeof(struct nlmsghdr),
it should print this faulty nlmsghdr.

> > Please add to the test all pathological cases we discussed so far.
> > 
> 
> So let's add a test where nlmsghdr->nlmsg_len is 0 and a test with
> nlmsghdr->nlmsg_len is greater than len. Do you have other pathological cases
> in mind?

- addr == NULL
- total_size == 0
- the first/next nlmsghdr is unfetchable
- the first/next nlmsghdr has nlmsg_len < sizeof(struct nlmsghdr)
- the first/next nlmsghdr has nlmsg_len > total_size


-- 
ldv

Attachment: pgpZEqW_UrpTs.pgp
Description: PGP signature

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to