This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] Use TLS buffer in ACL<->text conversion
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 23 Dec 2015 23:33:02 -0000
- Subject: [newlib-cygwin] Use TLS buffer in ACL<->text conversion
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3b8372c1f2ce6546da1d71de2254c18482430e36
commit 3b8372c1f2ce6546da1d71de2254c18482430e36
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Thu Dec 24 00:32:54 2015 +0100
Use TLS buffer in ACL<->text conversion
* sec_acl.cc (acltotext32): Use tmp_pathbuf rather than stack buffer.
(aclfromtext32): Ditto.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/ChangeLog | 5 +++++
winsup/cygwin/sec_acl.cc | 10 ++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 5f9eacf..c32519e 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2015-12-24 Corinna Vinschen <corinna@vinschen.de>
+ * sec_acl.cc (acltotext32): Use tmp_pathbuf rather than stack buffer.
+ (aclfromtext32): Ditto.
+
+2015-12-24 Corinna Vinschen <corinna@vinschen.de>
+
* sec_acl.cc: Cosmetic changes.
2015-12-18 Corinna Vinschen <corinna@vinschen.de>
diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
index dd75e32..348f0bc 100644
--- a/winsup/cygwin/sec_acl.cc
+++ b/winsup/cygwin/sec_acl.cc
@@ -1432,7 +1432,8 @@ acltotext32 (aclent_t *aclbufp, int aclcnt)
set_errno (EINVAL);
return NULL;
}
- char buf[32000];
+ tmp_pathbuf tp;
+ char *buf = tp.c_get ();
buf[0] = '\0';
bool first = true;
@@ -1502,16 +1503,17 @@ permfromstr (char *perm)
extern "C" aclent_t *
aclfromtext32 (char *acltextp, int *)
{
- if (!acltextp)
+ if (!acltextp || strlen (acltextp) > NT_MAX_PATH)
{
set_errno (EINVAL);
return NULL;
}
- char buf[strlen (acltextp) + 1];
+ tmp_pathbuf tp;
aclent_t lacl[MAX_ACL_ENTRIES];
memset (lacl, 0, sizeof lacl);
int pos = 0;
- strcpy (buf, acltextp);
+ char *buf = tp.t_get ();
+ stpcpy (buf, acltextp);
char *lasts;
cyg_ldap cldap;
for (char *c = strtok_r (buf, ",", &lasts);