summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_proc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler_proc.cc')
-rw-r--r--winsup/cygwin/fhandler_proc.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index 1c335c429..0fd2e569c 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -1360,7 +1360,8 @@ format_proc_cygdrive (void *, char *&destbuf)
{
destbuf = (char *) crealloc_abort (destbuf, mount_table->cygdrive_len + 1);
char *dend = stpcpy (destbuf, mount_table->cygdrive);
- *--dend = '\0';
+ if (dend > destbuf + 1) /* cygdrive != "/"? */
+ *--dend = '\0';
return dend - destbuf;
}