From 07da9e1a13f80f4256d12712e1c03889bff654a3 Mon Sep 17 00:00:00 2001 From: phumblet Date: Mon, 12 Apr 2004 23:59:23 +0000 Subject: [PATCH] 2004-04-12 Pierre Humblet * path.cc (path_conv::check): Fix "tail filling" logic. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/path.cc | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 00c0e2d8e2..3587b03d68 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2004-04-12 Pierre Humblet + + * path.cc (path_conv::check): Fix "tail filling" logic. + 2004-04-11 Christopher Faylor * cygheap.h: Replace inexplicably removed closing brace. diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 1fc9fc3ace..77c9087f99 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -499,7 +499,7 @@ path_conv::check (const char *src, unsigned opt, bool need_directory = 0; bool saw_symlinks = 0; int is_relpath; - char *tail; + char *tail, *path_end; #if 0 static path_conv last_path_conv; @@ -544,7 +544,7 @@ path_conv::check (const char *src, unsigned opt, need_directory = 1; *--tail = '\0'; } - char *path_end = tail; + path_end = tail; /* Scan path_copy from right to left looking either for a symlink or an actual existing file. If an existing file is found, just @@ -872,7 +872,7 @@ out: normalized_path_size = 0; else { - if (tail[1] != '\0') + if (tail < path_end && tail > path_copy + 1) *tail = '/'; set_normalized_path (path_copy); } -- 2.11.0