* path.cc (symlink): Check arguments for validity.
(getcwd): Ditto. * syscalls.cc (ftruncate): Ditto. * times.cc (times): Ditto. * uname.cc (uname): Ditto.
This commit is contained in:
parent
d595839939
commit
0aca521ab8
@ -1,3 +1,11 @@
|
|||||||
|
2001-09-16 Egor Duda <deo@logos-m.ru>
|
||||||
|
|
||||||
|
* path.cc (symlink): Check arguments for validity.
|
||||||
|
(getcwd): Ditto.
|
||||||
|
* syscalls.cc (ftruncate): Ditto.
|
||||||
|
* times.cc (times): Ditto.
|
||||||
|
* uname.cc (uname): Ditto.
|
||||||
|
|
||||||
Sat Sep 15 22:54:49 2001 Christopher Faylor <cgf@cygnus.com>
|
Sat Sep 15 22:54:49 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* net.cc (dup_servent_ptr): Detect old Windows 95 misaligned structure
|
* net.cc (dup_servent_ptr): Detect old Windows 95 misaligned structure
|
||||||
|
@ -2399,6 +2399,19 @@ symlink (const char *topath, const char *frompath)
|
|||||||
DWORD written;
|
DWORD written;
|
||||||
SECURITY_ATTRIBUTES sa = sec_none_nih;
|
SECURITY_ATTRIBUTES sa = sec_none_nih;
|
||||||
|
|
||||||
|
/* POSIX says that empty 'frompath' is invalid input whlie empty
|
||||||
|
'topath' is valid -- it's symlink resolver job to verify if
|
||||||
|
symlink contents point to existing filesystem object */
|
||||||
|
if (check_null_empty_str_errno (topath) == EFAULT ||
|
||||||
|
check_null_empty_str_errno (frompath))
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
if (strlen (topath) >= MAX_PATH)
|
||||||
|
{
|
||||||
|
set_errno (ENAMETOOLONG);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
win32_path.check (frompath, PC_SYM_NOFOLLOW);
|
win32_path.check (frompath, PC_SYM_NOFOLLOW);
|
||||||
if (allow_winsymlinks && !win32_path.error)
|
if (allow_winsymlinks && !win32_path.error)
|
||||||
{
|
{
|
||||||
@ -2415,17 +2428,6 @@ symlink (const char *topath, const char *frompath)
|
|||||||
|
|
||||||
syscall_printf ("symlink (%s, %s)", topath, win32_path.get_win32 ());
|
syscall_printf ("symlink (%s, %s)", topath, win32_path.get_win32 ());
|
||||||
|
|
||||||
if (topath[0] == 0)
|
|
||||||
{
|
|
||||||
set_errno (EINVAL);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if (strlen (topath) >= MAX_PATH)
|
|
||||||
{
|
|
||||||
set_errno (ENAMETOOLONG);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (win32_path.is_device () ||
|
if (win32_path.is_device () ||
|
||||||
win32_path.file_attributes () != (DWORD) -1)
|
win32_path.file_attributes () != (DWORD) -1)
|
||||||
{
|
{
|
||||||
@ -2984,7 +2986,12 @@ hashit:
|
|||||||
char *
|
char *
|
||||||
getcwd (char *buf, size_t ulen)
|
getcwd (char *buf, size_t ulen)
|
||||||
{
|
{
|
||||||
return cygheap->cwd.get (buf, 1, 1, ulen);
|
char* res = NULL;
|
||||||
|
if (ulen == 0)
|
||||||
|
set_errno (EINVAL);
|
||||||
|
else if (!__check_null_invalid_struct_errno (buf, ulen))
|
||||||
|
res = cygheap->cwd.get (buf, 1, 1, ulen);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getwd: standards? */
|
/* getwd: standards? */
|
||||||
|
@ -1768,7 +1768,11 @@ ftruncate (int fd, off_t length)
|
|||||||
sigframe thisframe (mainthread);
|
sigframe thisframe (mainthread);
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
if (cygheap->fdtab.not_open (fd))
|
if (length < 0)
|
||||||
|
{
|
||||||
|
set_errno (EINVAL);
|
||||||
|
}
|
||||||
|
else if (cygheap->fdtab.not_open (fd))
|
||||||
{
|
{
|
||||||
set_errno (EBADF);
|
set_errno (EBADF);
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,9 @@ times (struct tms * buf)
|
|||||||
{
|
{
|
||||||
FILETIME creation_time, exit_time, kernel_time, user_time;
|
FILETIME creation_time, exit_time, kernel_time, user_time;
|
||||||
|
|
||||||
|
if (check_null_invalid_struct_errno (buf))
|
||||||
|
return ((clock_t) -1);
|
||||||
|
|
||||||
DWORD ticks = GetTickCount ();
|
DWORD ticks = GetTickCount ();
|
||||||
/* Ticks is in milliseconds, convert to our ticks. Use long long to prevent
|
/* Ticks is in milliseconds, convert to our ticks. Use long long to prevent
|
||||||
overflow. */
|
overflow. */
|
||||||
|
@ -21,6 +21,10 @@ uname (struct utsname *name)
|
|||||||
{
|
{
|
||||||
DWORD len;
|
DWORD len;
|
||||||
SYSTEM_INFO sysinfo;
|
SYSTEM_INFO sysinfo;
|
||||||
|
|
||||||
|
if (check_null_invalid_struct_errno (name))
|
||||||
|
return -1;
|
||||||
|
|
||||||
char *snp = strstr (cygwin_version.dll_build_date, "SNP");
|
char *snp = strstr (cygwin_version.dll_build_date, "SNP");
|
||||||
|
|
||||||
memset (name, 0, sizeof (*name));
|
memset (name, 0, sizeof (*name));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user