From becf251f67689f14e1f9f3ba04b4b2ad586fc77e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 11 Mar 2008 11:42:00 +0000 Subject: * 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. --- winsup/cygwin/tls_pbuf.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/tls_pbuf.cc') 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++]; } -- cgit v1.2.3