public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] path_conv: When encountering a ".(/)+" sequence, skip *all* slashes
@ 2016-11-28 11:33 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2016-11-28 11:33 UTC (permalink / raw)
  To: cygwin-cvs

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

commit f0ae353a4fe00d3a33fdebaedc28ebac685463ad
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Nov 28 12:33:40 2016 +0100

    path_conv: When encountering a ".(/)+" sequence, skip *all* slashes
    
    The original code only skipped the "./", but missed to test if more
    trailing slashes are present.  This in turn leads to invalid conversion.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/path.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index aaf1928..3d07ea1 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1406,7 +1406,12 @@ normalize_win32_path (const char *src, char *dst, char *&tail)
       /* Ignore "./".  */
       else if (src[0] == '.' && isdirsep (src[1])
 	       && (src == src_start || isdirsep (src[-1])))
-	src += 2;
+	{
+	  src += 2;
+	  /* Skip /'s to the next path component. */
+	  while (isdirsep (*src))
+	    src++;
+	}
 
       /* Backup if "..".  */
       else if (src[0] == '.' && src[1] == '.'


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-28 11:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-28 11:33 [newlib-cygwin] path_conv: When encountering a ".(/)+" sequence, skip *all* slashes Corinna Vinschen

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).