public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/elfix:master commit in: misc/install-xattr/
Date: Thu,  9 Oct 2014 02:40:27 +0000 (UTC)	[thread overview]
Message-ID: <1412822331.24d22f45656fb88c63763ca319a2275b8f642d9e.blueness@gentoo> (raw)

commit:     24d22f45656fb88c63763ca319a2275b8f642d9e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  9 02:38:51 2014 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Oct  9 02:38:51 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=24d22f45

misc/install-xattr: correct potential fork bomb

The which() function compares portage_helper_path, to canpath
and skips it when appropriate:

	if (portage_helper_path)
		if (!strcmp(portage_helper_path, canpath))
			goto skip;

However, portage_helper_path has not been canonicalized with
the realpath function, so strcmp can return false even though
the paths are equivalent.  This may occurs when /usr/lib is a
symlink to /usr/lib64.

X-Gentoo-Bug: 523994
X-Gentoo-Bug-URL: https://bugs.gentoo.org/523994

---
 misc/install-xattr/install-xattr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/misc/install-xattr/install-xattr.c b/misc/install-xattr/install-xattr.c
index 805c0a4..2f349df 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -325,6 +325,7 @@ main(int argc, char* argv[])
 	 */
 	char *oldpwd = getenv("OLDPWD");
 	char *portage_helper_path = getenv("__PORTAGE_HELPER_PATH");
+	char *portage_helper_canpath = NULL;
 	if (portage_helper_path)
 		chdir(oldpwd);
 
@@ -334,8 +335,11 @@ main(int argc, char* argv[])
 
 		case 0:
 			/* find system install avoiding mypath and portage_helper_path! */
-			install = which(mypath, portage_helper_path);
+			if (portage_helper_path)
+				portage_helper_canpath = realpath(portage_helper_path, NULL);
+			install = which(mypath, portage_helper_canpath);
 			free(mypath);
+			free(portage_helper_canpath);
 			argv[0] = install;        /* so coreutils' lib/program.c behaves  */
 			execv(install, argv);     /* The kernel will free(install).       */
 			err(1, "execv() failed");


             reply	other threads:[~2014-10-09  2:40 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09  2:40 Anthony G. Basile [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-01-29  3:57 [gentoo-commits] proj/elfix:master commit in: misc/install-xattr/ Sam James
2023-01-24  3:05 Sam James
2023-01-24  3:05 Sam James
2023-01-11  6:53 Sam James
2023-01-10  5:21 Sam James
2023-01-10  5:21 Sam James
2019-11-10  0:59 Anthony G. Basile
2019-11-10  0:54 Anthony G. Basile
2019-11-10  0:54 Anthony G. Basile
2019-11-09 18:24 Anthony G. Basile
2019-11-09 18:24 Anthony G. Basile
2019-04-14 18:40 Anthony G. Basile
2019-03-30 10:12 Anthony G. Basile
2015-06-08 13:07 Anthony G. Basile
2015-05-29 11:32 Anthony G. Basile
2014-11-02 21:46 Anthony G. Basile
2014-10-13  2:28 Anthony G. Basile
2014-10-13  2:20 Anthony G. Basile
2014-07-21 21:25 Anthony G. Basile
2014-06-27 12:26 Anthony G. Basile
2014-06-27 12:26 Anthony G. Basile
2014-06-24 21:49 Anthony G. Basile
2014-06-15 22:09 Anthony G. Basile
2014-06-11 11:25 Anthony G. Basile
2014-06-10 21:04 Anthony G. Basile
2014-06-10  1:49 Anthony G. Basile
2014-06-10  1:49 Anthony G. Basile
2014-06-08 20:27 Anthony G. Basile
2014-06-01  0:26 Anthony G. Basile
2014-02-13 19:08 Anthony G. Basile
2014-02-13 19:01 Anthony G. Basile
2014-02-13 18:48 Anthony G. Basile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412822331.24d22f45656fb88c63763ca319a2275b8f642d9e.blueness@gentoo \
    --to=blueness@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox