delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/01/20/20:05:01

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=AWL,BAYES_50,MAY_BE_FORGED,RCVD_IN_DNSWL_HI
X-Spam-Check-By: sourceware.org
From: "Jonathan Kamens" <jik AT kamens DOT us>
To: <cygwin AT cygwin DOT com>
Cc: <cygwin AT cwilson DOT fastmail DOT fm>
References: <004801cba91c$f13b60d0$d3b22270$@kamens.us> <008501cbae87$11dbda30$35938e90$@kamens.us>
In-Reply-To: <008501cbae87$11dbda30$35938e90$@kamens.us>
Subject: RE: Bug report for run.exe with patch
Date: Thu, 20 Jan 2011 20:04:10 -0500
Message-ID: <003a01cbb907$31db5b00$95921100$@us>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

------=_NextPart_000_003B_01CBB8DD.49055300
Content-Type: text/plain;
	boundary="----=_NextPart_000_002C_01CBB8DC.E68B8410";
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

This is a bug in a program that is installed and used in pretty much every
single Cygwin installation in the world.

Other people have reported encountering the bug.

I've identified the bug and provided a patch, three weeks ago.

Can I please get someone in a position to release the fix to acknowledge my
existence?

Much obliged,

  jik

-----Original Message-----
From: Jonathan Kamens [jik at kamens dot us]=20
Sent: Friday, January 07, 2011 11:22 AM
To: cygwin at cygwin dot com
Subject: RE: Bug report for run.exe with patch

ACK?

-----Original Message-----
From: Jonathan Kamens [jik at kamens dot us]=20
Sent: Friday, December 31, 2010 2:00 PM
To: cygwin at cygwin dot com
Subject: Bug report for run.exe with patch

Several people have reported problems with run.exe complaining about being
unable to execute programs.

The typical symptoms of the problem are that the user clicks on a link in
the Start menu that uses run.exe and gets back an error pop-up from run.exe
that looks like this:

Error could not start C:\cygwin\bin\emacs-X11.exe [some extra characters
here that shouldn=92t be] -display 127.0.0.1:0.0

I just encountered this issue and tracked down the root cause, which is that
run.exe doesn=92t null-terminate the data returned by readlink(). According=
 to
the readlink(3) man page on Linux, =93Conforming applications should not
assume that the returned contents of the symbolic link are null-terminated,=
=94
and indeed, at least in some circumstances they are not.

I have attached a patch.

Share and enjoy. :-)

Thanks,

=A0 Jonathan Kamens

------=_NextPart_000_003B_01CBB8DD.49055300
Content-Type: application/octet-stream;
	name="run-1.1.12-11.readlink.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="run-1.1.12-11.readlink.patch"

diff -rup run-1.1.12/src/run.c /tmp/run-1.1.12/src/run.c
--- old/run-1.1.12/src/run.c	2010-12-31 13:43:05.770732300 -0500
+++ run-1.1.12/src/run.c	2010-12-31 13:41:13.093732300 -0500
@@ -810,10 +810,16 @@ void process_execname(char *exec, const
       {
          if ((stbuf.st_mode & S_IFLNK) =3D=3D S_IFLNK)
          {
-	    if (readlink(sym_link_name, real_name, sizeof(real_name)) =3D=3D -1)
+	    ssize_t len;
+
+	    if ((len =3D readlink(sym_link_name, real_name, sizeof(real_name))) =
=3D=3D -1)
                error("problem reading symbolic link for %s",exec_tmp);
             else
             {
+		if (len < sizeof(real_name))
+		    real_name[len] =3D '\0';
+		else
+		    error("symlink pointed to by %s is too long", sym_link_name);
                 /* if realname starts with '/' it's a rootpath */
                 if (real_name[0] =3D=3D '/')
                     strcpy(exec_tmp2,real_name);


------=_NextPart_000_003B_01CBB8DD.49055300
Content-Type: text/plain; charset=us-ascii

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
------=_NextPart_000_003B_01CBB8DD.49055300--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019