This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[Patch] setup: site.cc: dot[3] may not be valid.
- From: Bas van Gompel <cygwin-apps dot buzz at bavag dot tmfweb dot nl>
- To: cygwin-apps at cygwin dot com
- Date: Tue, 25 Oct 2005 01:42:56 +0200 (MET DST)
- Subject: [Patch] setup: site.cc: dot[3] may not be valid.
- Organisation: Ehm...
- Reply-to: cygwin-apps mailing-list <cygwin-apps at cygwin dot com>
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