aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-04-02 17:44:01 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-04-02 17:44:01 +0000
commiteab96f6b22353141b4ff2c78828a36722c6026c4 (patch)
tree61bdbd45226551f40dc13b003209269da788937a /winsup
parentbe37a55086d3fcb0e999d4048fca171316e01c35 (diff)
downloadnewlib-eab96f6b22353141b4ff2c78828a36722c6026c4.zip
newlib-eab96f6b22353141b4ff2c78828a36722c6026c4.tar.gz
newlib-eab96f6b22353141b4ff2c78828a36722c6026c4.tar.bz2
* environ.cc (build_env): Fix length calculation of resulting
wide char environment string.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/environ.cc4
2 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index f91fe4d..c901d09 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-02 Corinna Vinschen <corinna@vinschen.de>
+
+ * environ.cc (build_env): Fix length calculation of resulting
+ wide char environment string.
+
2009-04-02 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* include/netdb.h: #include <inttypes.h>, <netinet/in.h>,
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 75e1ffb..8124e68 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -1080,7 +1080,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
else
p = *srcp; /* Don't worry about it */
- len = strlen (p) + 1;
+ len = sys_mbstowcs (NULL, 0, p);
new_tl += len; /* Keep running total of block length so far */
/* See if we need to increase the size of the block. */
@@ -1097,7 +1097,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc,
}
}
- int slen = sys_mbstowcs (s, len, p, len);
+ int slen = sys_mbstowcs (s, len, p);
/* See if environment variable is "special" in a Windows sense.
Under NT, the current directories for visited drives are stored