Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-03-11 14:42:00 +0300
committerCorinna Vinschen <corinna@vinschen.de>2008-03-11 14:42:00 +0300
commitbecf251f67689f14e1f9f3ba04b4b2ad586fc77e (patch)
tree268bedae59386c798cab8889834a2dba822d197f /winsup/cygwin/tls_pbuf.cc
parentff488124ff455b4fe3271282b1585adea74eb84d (diff)
* environ.cc (parse_options): Use tmp_pathbuf to allocate buffer.
(regopt): Take tmp buffer as additional argument. (environ_init): Alllcate tmpbuf earlier. Use as temporary buffer in call to regopt. * tls_pbuf.cc (tmp_pathbuf::c_get): Allocate one additional char. (tmp_pathbuf::w_get): Allocate one additional WCHAR. * winf.cc (av::unshift): Use tmp_pathbuf to allocate buffer.
Diffstat (limited to 'winsup/cygwin/tls_pbuf.cc')
-rw-r--r--winsup/cygwin/tls_pbuf.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/tls_pbuf.cc b/winsup/cygwin/tls_pbuf.cc
index 704f3bfc9..802885ebc 100644
--- a/winsup/cygwin/tls_pbuf.cc
+++ b/winsup/cygwin/tls_pbuf.cc
@@ -42,7 +42,7 @@ tmp_pathbuf::c_get ()
if (tls_pbuf.c_cnt >= TP_NUM_C_BUFS)
api_fatal ("Internal error: TP_NUM_C_BUFS too small.");
if (!tls_pbuf.c_buf[tls_pbuf.c_cnt]
- && !(tls_pbuf.c_buf[tls_pbuf.c_cnt] = (char *) malloc (NT_MAX_PATH)))
+ && !(tls_pbuf.c_buf[tls_pbuf.c_cnt] = (char *) malloc (NT_MAX_PATH + 1)))
api_fatal ("Internal error: Out of memory for new path buf.");
return tls_pbuf.c_buf[tls_pbuf.c_cnt++];
}
@@ -54,7 +54,7 @@ tmp_pathbuf::w_get ()
api_fatal ("Internal error: TP_NUM_W_BUFS too small.");
if (!tls_pbuf.w_buf[tls_pbuf.w_cnt]
&& !(tls_pbuf.w_buf[tls_pbuf.w_cnt]
- = (PWCHAR) malloc (NT_MAX_PATH * sizeof (WCHAR))))
+ = (PWCHAR) malloc ((NT_MAX_PATH + 1) * sizeof (WCHAR))))
api_fatal ("Internal error: Out of memory for new wide path buf.");
return tls_pbuf.w_buf[tls_pbuf.w_cnt++];
}