Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-06-17 20:52:18 +0400
committerChristopher Faylor <me@cgf.cx>2003-06-17 20:52:18 +0400
commit0d58ef9daca5f27a8a8bb46c1836ea0d28967bd2 (patch)
tree6ba12721e716cabb8d99f9e0c496eb025ce562ce /winsup/cygwin
parentc89701c687755cbff0ec0ca200c55d5d494aee0f (diff)
* path.cc (mount): Do more strict checking on posix path arguments.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc13
2 files changed, 15 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 441da04e5..e1706ec4a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-17 Christopher Faylor <cgf@redhat.com>
+
+ * path.cc (mount): Do more strict checking on posix path arguments.
+
2003-06-15 Christopher Faylor <cgf@redhat.com>
Throughout, remove "include <errno.h>" from files which already include
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 3f6c1e79b..d0648192d 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1894,10 +1894,16 @@ mount_info::from_registry ()
/* FIXME: Need a mutex to avoid collisions with other tasks. */
int
-mount_info::add_reg_mount (const char * native_path, const char * posix_path, unsigned mountflags)
+mount_info::add_reg_mount (const char *native_path, const char *posix_path, unsigned mountflags)
{
int res = 0;
+ if (strchr (posix_path, '\\'))
+ {
+ set_errno (EINVAL);
+ goto err1;
+ }
+
/* Add the mount to the right registry location, depending on
whether MOUNT_SYSTEM is set in the mount flags. */
if (!(mountflags & MOUNT_SYSTEM)) /* current_user mount */
@@ -1948,6 +1954,7 @@ mount_info::add_reg_mount (const char * native_path, const char * posix_path, un
return 0; /* Success */
err:
__seterrno_from_win_error (res);
+ err1:
return -1;
}
@@ -2497,7 +2504,9 @@ mount (const char *win32_path, const char *posix_path, unsigned flags)
{
int res = -1;
- if (flags & MOUNT_CYGDRIVE) /* normal mount */
+ if (strpbrk (posix_path, "\\:"))
+ set_errno (EINVAL);
+ else if (flags & MOUNT_CYGDRIVE) /* normal mount */
{
/* When flags include MOUNT_CYGDRIVE, take this to mean that
we actually want to change the cygdrive prefix and flags