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>
This commit is contained in:
Corinna Vinschen 2015-12-24 00:32:54 +01:00
parent 62fe4404a7
commit 3b8372c1f2
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,8 @@
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.

View File

@ -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);