Hi Mike,
On Fri, Aug 1, 2014 at 4:25 PM, Mike Frysinger <vap...@gentoo.org> wrote:
> On Thu 03 Jul 2014 17:45:41 zubin.mit...@gmail.com wrote:
> > From: Zubin Mithra <zubin.mit...@gmail.com>
> >
> > * file.c (sys_getdents): Add d_reclen check.
> > (sys_getdents64): Add d_reclen check.
> >
> > Signed-off-by: Zubin Mithra <zubin.mit...@gmail.com>
> > ---
> > file.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/file.c b/file.c
> > index a92a7dc..d739df6 100644
> > --- a/file.c
> > +++ b/file.c
> > @@ -2041,7 +2041,8 @@ sys_readdir(struct tcb *tcp)
> > int
> > sys_getdents(struct tcb *tcp)
> > {
> > - int i, len, dents = 0;
> > + unsigned int i;
> > + int len, dents = 0;
> > char *buf;
> >
> > if (entering(tcp)) {
> > @@ -2076,6 +2077,10 @@ sys_getdents(struct tcb *tcp)
> > i ? " " : "", d->d_ino, d->d_off);
> > tprintf("d_reclen=%u, d_name=\"%s\", d_type=",
> > d->d_reclen, d->d_name);
> > + if (i + d->d_reclen >= len) {
> > + tprints("}");
> > + break;
> > + }
>
> you shouldn't compare signed & unsigned values. i'm not sure this code
> needs
> to have "i" converted to unsigned considering the top of it makes sure to
> clamp the value of len to [0, 1024*1024].
>
> also, should it be "...}" to indicate that there's something, but we're
> ignoring it ? maybe not since we already silently clamp the result ...
Thank you for the review, Mike ! I've made the two changes and sent over a
patch for the same.
Thanks!
Zubin
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel