Re: Geek fun in Squid's source code

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 29 Jun 2012 12:53:02 +1200

On 29/06/2012 12:01 a.m., Kinkie wrote:
> from support_netbios.cc:
>
> if (p == np) {
>
>
> (stumbled into this while sweeping the sources changing postincrement
> to preincrement operators).
>
> --
> /kinkie

Why do you bring this up?

Set two pointers to the start of a string, increment one until some
delimiter. If they are both still identical the scan produced an empty
string.
  --> Saves loading a constant into memory for comparison and
de-referencing one or both of the pointers to match it against.

What I do note about this is that the CR LF "skip" loop will make the
above logics break and permit binary usernames of "<CR>@foo" or
"<LF>@foo" through to the backend. I'm not sure if that is valid? or if
there is a missing (++np) operation to actually drop those octets from
the validation.

Amos
Received on Fri Jun 29 2012 - 00:53:17 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 29 2012 - 12:00:06 MDT