Index: path.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/path.cc,v
retrieving revision 1.162
diff -u -p -2 -r1.162 path.cc
--- path.cc	2001/09/07 21:32:04	1.162
+++ path.cc	2001/09/15 19:42:02
@@ -2400,4 +2400,17 @@ symlink (const char *topath, const char 
   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);
   if (allow_winsymlinks && !win32_path.error)
@@ -2416,15 +2429,4 @@ symlink (const char *topath, const char 
   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 () ||
       win32_path.file_attributes () != (DWORD) -1)
@@ -2985,5 +2987,10 @@ char *
 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;
 }
 
Index: syscalls.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/syscalls.cc,v
retrieving revision 1.144
diff -u -p -2 -r1.144 syscalls.cc
--- syscalls.cc	2001/09/12 17:46:36	1.144
+++ syscalls.cc	2001/09/15 19:42:04
@@ -1769,5 +1769,9 @@ ftruncate (int fd, off_t length)
   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);
Index: times.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/times.cc,v
retrieving revision 1.22
diff -u -p -2 -r1.22 times.cc
--- times.cc	2001/09/12 17:46:36	1.22
+++ times.cc	2001/09/15 19:42:04
@@ -53,4 +53,7 @@ times (struct tms * buf)
   FILETIME creation_time, exit_time, kernel_time, user_time;
 
+  if (check_null_invalid_struct_errno (buf))
+    return ((clock_t) -1);
+
   DWORD ticks = GetTickCount ();
   /* Ticks is in milliseconds, convert to our ticks. Use long long to prevent
Index: uname.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/uname.cc,v
retrieving revision 1.14
diff -u -p -2 -r1.14 uname.cc
--- uname.cc	2001/09/12 17:46:37	1.14
+++ uname.cc	2001/09/15 19:42:04
@@ -22,4 +22,8 @@ uname (struct utsname *name)
   DWORD len;
   SYSTEM_INFO sysinfo;
+
+  if (check_null_invalid_struct_errno (name))
+    return -1;
+    
   char *snp = strstr  (cygwin_version.dll_build_date, "SNP");
 
