summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-04-08 04:47:15 +0000
committerChristopher Faylor <me@cgf.cx>2000-04-08 04:47:15 +0000
commitaf3e5ed27959f94ca8040ffa5574d1bf88549080 (patch)
tree6081641930f77d022536dd4a4b836121f0314f3b /winsup/cygwin/fhandler.cc
parent0cda2f4609291ee1394935aca76eb740a67a5473 (diff)
downloadcygnal-af3e5ed27959f94ca8040ffa5574d1bf88549080.tar.gz
cygnal-af3e5ed27959f94ca8040ffa5574d1bf88549080.tar.bz2
cygnal-af3e5ed27959f94ca8040ffa5574d1bf88549080.zip
* fhandler.cc (fhandler_disk_file::fstat): Allocate enough space for root dir
determination or overflow an array.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index d33b60c8c..1003815fb 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -887,8 +887,9 @@ fhandler_disk_file::fstat (struct stat *buf)
buf->st_dev = local.dwVolumeSerialNumber;
buf->st_size = local.nFileSizeLow;
- /* Allocate some place to determine the root directory. */
- char root[strlen (get_win32_name ()) + 1];
+ /* Allocate some place to determine the root directory. Need to allocate
+ enough so that rootdir can add a trailing slash if path starts with \\. */
+ char root[strlen (get_win32_name ()) + 3];
strcpy (root, get_win32_name ());
/* Assume that if a drive has ACL support it MAY have valid "inodes".