[Patch] setup: site.cc: dot[3] may not be valid.
Bas van Gompel
cygwin-apps.buzz@bavag.tmfweb.nl
Mon Oct 24 23:43:00 GMT 2005
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 <patch-cygsup.buzz@bavag.tmfweb.nl>
* 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++;
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
More information about the Cygwin-apps
mailing list