2004-04-12 Pierre Humblet <pierre.humblet@ieee.org>

* path.cc (path_conv::check): Fix "tail filling" logic.
This commit is contained in:
Pierre Humblet 2004-04-12 23:59:23 +00:00
parent 1ed8d18733
commit b96dbd203d
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2004-04-12 Pierre Humblet <pierre.humblet@ieee.org>
* path.cc (path_conv::check): Fix "tail filling" logic.
2004-04-11 Christopher Faylor <cgf@alum.bu.edu> 2004-04-11 Christopher Faylor <cgf@alum.bu.edu>
* cygheap.h: Replace inexplicably removed closing brace. * cygheap.h: Replace inexplicably removed closing brace.

View File

@ -499,7 +499,7 @@ path_conv::check (const char *src, unsigned opt,
bool need_directory = 0; bool need_directory = 0;
bool saw_symlinks = 0; bool saw_symlinks = 0;
int is_relpath; int is_relpath;
char *tail; char *tail, *path_end;
#if 0 #if 0
static path_conv last_path_conv; static path_conv last_path_conv;
@ -544,7 +544,7 @@ path_conv::check (const char *src, unsigned opt,
need_directory = 1; need_directory = 1;
*--tail = '\0'; *--tail = '\0';
} }
char *path_end = tail; path_end = tail;
/* Scan path_copy from right to left looking either for a symlink /* Scan path_copy from right to left looking either for a symlink
or an actual existing file. If an existing file is found, just or an actual existing file. If an existing file is found, just
@ -872,7 +872,7 @@ out:
normalized_path_size = 0; normalized_path_size = 0;
else else
{ {
if (tail[1] != '\0') if (tail < path_end && tail > path_copy + 1)
*tail = '/'; *tail = '/';
set_normalized_path (path_copy); set_normalized_path (path_copy);
} }