Re: [Patch] setup: site.cc: dot[3] may not be valid.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Patch] setup: site.cc: dot[3] may not be valid.

Max O Bowsher
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bas van Gompel wrote:

> Hi,
>
> While looking at site.cc I noticed a check where dot[3] might
> point past the end of the allocated string. this may cause false
> matches or even a segfault. I suggest following:
>
>
> 2005-10-24  Bas van Gompel  <[hidden email]>
>
> * site.cc (site_list_type::init): Avoid reading past end of
> string.
>
>
> --- setup/site.cc 14 Oct 2005 04:23:14 -0000 2.40
> +++ setup/site.cc 24 Oct 2005 18:05:14 -0000
> @@ -122,7 +122,7 @@ site_list_type::init (String const &newu
>        if (*dot == '.' || *dot == '/')
>   {
>    char *sp;
> -  if (dot[3] == 0)
> +  if (strlen (dot) == 3)
>      *dp++ = '~'; /* sort .com/.edu/.org together */
>    for (sp = dot + 1; *sp && *sp != '.' && *sp != '/';)
>      *dp++ = *sp++;
>

The terrifying irony here, is that after all this icky pointer
manipulation, the calculated value is totally ignored anyway!

I've rewritten all the pointer work in terms of STL strings, and will
commit it now.


Max.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFDjiVOfFNSmcDyxYARAhIVAKCCMoRlC9QNYpTwBfKCr3wdIUgt4ACgjKHX
UxexDF8boYvi94M2cXC7+rU=
=WxOm
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: [Patch] setup: site.cc: dot[3] may not be valid.

Buzz-4
Op Wed, 30 Nov 2005 22:18:54 +0000 schreef Max Bowsher
in <438E254E.5070101<at>ukf.net>:
:  Bas van Gompel wrote:
[patch]

:  The terrifying irony here, is that after all this icky pointer
:  manipulation, the calculated value is totally ignored anyway!

:  I've rewritten all the pointer work in terms of STL strings, and will
:  commit it now.

Nice, but three-letter TLDs now sort at the beginning, not the end.


L8r,

Buzz.
--
  ) |  | ---/ ---/  Yes, this | This message consists of true | I do not
--  |  |   /    /   really is |   and false bits entirely.    | mail for
  ) |  |  /    /    a 72 by 4 +-------------------------------+ any1 but
--  \--| /--- /---  .sigfile. |   |perl -pe "s.u(z)\1.as."    | me. 4^re
Reply | Threaded
Open this post in threaded view
|

Re: [Patch] setup: site.cc: dot[3] may not be valid.

Max O Bowsher
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bas van Gompel wrote:

> Op Wed, 30 Nov 2005 22:18:54 +0000 schreef Max Bowsher
> in <438E254E.5070101<at>ukf.net>:
> :  Bas van Gompel wrote:
> [patch]
>
> :  The terrifying irony here, is that after all this icky pointer
> :  manipulation, the calculated value is totally ignored anyway!
>
> :  I've rewritten all the pointer work in terms of STL strings, and will
> :  commit it now.
>
> Nice, but three-letter TLDs now sort at the beginning, not the end.

I'd assumed that was what the original coder intended.

I'm quite happy to put them at the end, if consensus points that way.

Max.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFDjyirfFNSmcDyxYARAukDAJ9gnTxM9F4NAKjJ5jqJPM9gWMMpvACeM0La
HREEueQ7QMyFunaF9rQNjvM=
=bw03
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: [Patch] setup: site.cc: dot[3] may not be valid.

Buzz-4
Op Thu, 01 Dec 2005 16:45:31 +0000 schreef Max Bowsher
in <438F28AB.80109<at>ukf.net>:
:  Bas van Gompel wrote:
: > Op Wed, 30 Nov 2005 22:18:54 +0000 schreef Max Bowsher
: > in <438E254E.5070101<at>ukf.net>:
[patch for site.cc]

: > :  I've rewritten all the pointer work in terms of STL strings, and will
: > :  commit it now.
: >
: > Nice, but three-letter TLDs now sort at the beginning, not the end.

:  I'd assumed that was what the original coder intended.

How odd. The original code used '~'.

:  I'm quite happy to put them at the end, if consensus points that way.

I have no strong opinion on this either way.


BTW: Is anybody working on using a listview or treeview iso a listbox
     for the site-list? if not, I might have a go...


L8r,

Buzz.
--
  ) |  | ---/ ---/  Yes, this | This message consists of true | I do not
--  |  |   /    /   really is |   and false bits entirely.    | mail for
  ) |  |  /    /    a 72 by 4 +-------------------------------+ any1 but
--  \--| /--- /---  .sigfile. |   |perl -pe "s.u(z)\1.as."    | me. 4^re
Reply | Threaded
Open this post in threaded view
|

Re: [Patch] setup: site.cc: dot[3] may not be valid.

Max O Bowsher
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bas van Gompel wrote:

> Op Thu, 01 Dec 2005 16:45:31 +0000 schreef Max Bowsher
> in <438F28AB.80109<at>ukf.net>:
> :  Bas van Gompel wrote:
> : > Op Wed, 30 Nov 2005 22:18:54 +0000 schreef Max Bowsher
> : > in <438E254E.5070101<at>ukf.net>:
> [patch for site.cc]
>
> : > :  I've rewritten all the pointer work in terms of STL strings, and will
> : > :  commit it now.
> : >
> : > Nice, but three-letter TLDs now sort at the beginning, not the end.
>
> :  I'd assumed that was what the original coder intended.
>
> How odd. The original code used '~'.

True. What I meant was, given the choice between putting the
geographically-indeterminate sites first, or putting all the sites in
countries beginning with 'a' first, I chose the former, and I'm assuming
this is an obvious choice, but it was never made, since the
categorization code was broken.

> :  I'm quite happy to put them at the end, if consensus points that way.
>
> I have no strong opinion on this either way.
>
>
> BTW: Is anybody working on using a listview or treeview iso a listbox
>      for the site-list? if not, I might have a go...

There was a mention this month by Rajesh Balakrishnan, though that was
only a possibility, not a definite intention.

Max.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)

iD8DBQFDj5JdfFNSmcDyxYARAqvPAJ0W20sNPt3Dsq0dJsegdjCKujJ3VgCg2XXO
8xGfKjPQ6VpLPGGWffjRVuA=
=Xsf+
-----END PGP SIGNATURE-----