Ethereal-dev: [Ethereal-dev] Re: rev 15993: /trunk/epan/dissectors/: packet-ospf.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: ronnie sahlberg <ronniesahlberg@xxxxxxxxx>
Date: Sat, 24 Sep 2005 21:43:08 -0400
ive just checked in a patch for this redundant test
(if position >0 )  the last character will never be '/' anyway)

There was no risk of accessing element  -1  since
(position>0) && (...[position-1]

&& always evaluate left to right and shortcircuit the expression if
the left hand side of && evaluates to false.



On 9/24/05, ronnie sahlberg <ronniesahlberg@xxxxxxxxx> wrote:
> yes   just remove them
>
> On 9/24/05, Ulf Lamping <ulf.lamping@xxxxxx> wrote:
> > sahlberg@xxxxxxxxxxxx wrote:
> >
> > >User: sahlberg
> > >Date: 2005/09/24 04:22 PM
> > >
> > >Log:
> > > remove an array from the stack,   remove some strcpy() and strcat()
> calls
> > >
> > >Directory: /trunk/epan/dissectors/
> > >  Changes    Path             Action
> > >  +15 -16    packet-ospf.c    Modified
> > >
> > >
> > >
> > >
> > >
> > Hmmm, any idea what the expression:
> >
> > && (prefix_options_string[position-1] != '/')
> >
> > in the if expressions are for?
> >
> > I don't see any reason.
> >
> > Beside the fact that it's buggy, as it will access
> > prefix_options_string[-1] if the former options weren't set.
> >
> > Simply remove them?
> >
> > Regards, ULFL
> >
> > _______________________________________________
> > Ethereal-dev mailing list
> > Ethereal-dev@xxxxxxxxxxxx
> > http://www.ethereal.com/mailman/listinfo/ethereal-dev
> >
>