[sslh] libevent port?

Yves Rutschle yves at naryves.com
Tue Sep 17 06:48:13 CEST 2013


On Tue, Sep 17, 2013 at 06:26:49AM +0200, Yves Rutschle wrote:
> I need to go through that slowly, but I think I'm going to
> disagree with most of this.

Please ignore this, I'm obviously wrong:

> >  static int is_tinc_protocol( const char *p, int len, struct proto *proto)
> >  {
> > +    if (len < 2)
> > +        return 0;
> > +
> >      return !strncmp(p, "0 ", 2);
> >  }
>   
> The test adds two lines of code which are completly
> redundant with the strncmp. If *p contains a NULL at the
> second character (or even first character), so what? strncmp
> will just fail there and then.

Me idiot, that's not the point: what if you get a zero-byte
packet, and compare to uninitialised data containing "0 "?

Goes to show one should not post before one's coffee is
digested.

Y.



More information about the sslh mailing list