* path.cc (mount): Do more strict checking on posix path arguments.
This commit is contained in:
parent
c89701c687
commit
0d58ef9dac
|
@ -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>
|
2003-06-15 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
Throughout, remove "include <errno.h>" from files which already include
|
Throughout, remove "include <errno.h>" from files which already include
|
||||||
|
|
|
@ -1898,6 +1898,12 @@ mount_info::add_reg_mount (const char * native_path, const char * posix_path, un
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
|
if (strchr (posix_path, '\\'))
|
||||||
|
{
|
||||||
|
set_errno (EINVAL);
|
||||||
|
goto err1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Add the mount to the right registry location, depending on
|
/* Add the mount to the right registry location, depending on
|
||||||
whether MOUNT_SYSTEM is set in the mount flags. */
|
whether MOUNT_SYSTEM is set in the mount flags. */
|
||||||
if (!(mountflags & MOUNT_SYSTEM)) /* current_user mount */
|
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 */
|
return 0; /* Success */
|
||||||
err:
|
err:
|
||||||
__seterrno_from_win_error (res);
|
__seterrno_from_win_error (res);
|
||||||
|
err1:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2497,7 +2504,9 @@ mount (const char *win32_path, const char *posix_path, unsigned flags)
|
||||||
{
|
{
|
||||||
int res = -1;
|
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
|
/* When flags include MOUNT_CYGDRIVE, take this to mean that
|
||||||
we actually want to change the cygdrive prefix and flags
|
we actually want to change the cygdrive prefix and flags
|
||||||
|
|
Loading…
Reference in New Issue