public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: path_conv: make sure sym.path_flags is always initialized
Date: Wed, 21 Dec 2022 12:15:29 +0000 (GMT)	[thread overview]
Message-ID: <20221221121529.00E833858D1E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=09cb4cd2940ff4c8b863cfa2fd2b043b8da0dca2

commit 09cb4cd2940ff4c8b863cfa2fd2b043b8da0dca2
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Wed Dec 21 13:08:39 2022 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Wed Dec 21 13:13:24 2022 +0100

    Cygwin: path_conv: make sure sym.path_flags is always initialized
    
    Commit c1023ee353705 introduced a split between mount flags and
    path flags.  It didn't initialize symlink_info::path_flags in
    path_conv::check, because that's done in symlink_info::check.
    
    However, there are two code paths expecting symlink_info::path_flags
    being already initialized and both skip symlink_info::check.
    
    Make sure symlink_info::path_flags is initalized to 0 early in
    path_conv::check.
    
    Fixes: c1023ee353705 ("Cygwin: path_conv: decouple path_types from mount types")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/path.cc       | 2 +-
 winsup/cygwin/release/3.4.4 | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 4df389bba257..eaf695b8182a 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -718,6 +718,7 @@ path_conv::check (const char *src, unsigned opt,
 	  /* FIXME: Do we have to worry about multiple \'s here? */
 	  component = 0;		// Number of translated components
 	  sym.contents[0] = '\0';
+	  sym.path_flags = 0;
 
 	  int symlen = 0;
 
@@ -912,7 +913,6 @@ path_conv::check (const char *src, unsigned opt,
 		{
 		  fileattr = 0;
 		  mount_flags = sym.mount_flags;
-		  path_flags = sym.path_flags;
 		  if (component)
 		    {
 		      error = ENOTDIR;
diff --git a/winsup/cygwin/release/3.4.4 b/winsup/cygwin/release/3.4.4
new file mode 100644
index 000000000000..6ac702375cca
--- /dev/null
+++ b/winsup/cygwin/release/3.4.4
@@ -0,0 +1,5 @@
+Bug Fixes
+---------
+
+- Fix an uninitialized variable having weird side-effects in path handling.
+  Addresses: https://cygwin.com/pipermail/cygwin/2022-December/252734.html

                 reply	other threads:[~2022-12-21 12:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221221121529.00E833858D1E@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).