Mercurial > illumos > illumos-gate
changeset 922:f5c8f1a2c9e3
6332352 acltotext(3SEC) can overwrite the acl pointer it returns
author | hm123892 |
---|---|
date | Tue, 15 Nov 2005 03:49:15 -0800 |
parents | 1bb512d7785a |
children | 78f6e60ae914 |
files | usr/src/lib/libsec/common/acltext.c |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/libsec/common/acltext.c Tue Nov 15 01:52:32 2005 -0800 +++ b/usr/src/lib/libsec/common/acltext.c Tue Nov 15 03:49:15 2005 -0800 @@ -61,6 +61,8 @@ #define PERMS 4 #define ACL_ENTRY_SIZE (ENTRYTYPELEN + LOGNAME_MAX + PERMS) +#define UPDATE_WHERE where = dstr->aclexport + strlen(dstr->aclexport) + struct dynaclstr { size_t bufsize; /* current size of aclexport */ char *aclexport; @@ -140,14 +142,13 @@ if (passwdp == (struct passwd *)NULL) { /* put in uid instead */ (void) sprintf(where, "%d", aclp->a_id); + UPDATE_WHERE; } else { excess = strlen(passwdp->pw_name) - LOGNAME_MAX; if (excess > 0) { rtn = increase_length(dstr, excess); if (rtn == 1) { - /* reset where */ - where = dstr->aclexport + - strlen(dstr->aclexport); + UPDATE_WHERE; } else { free(dstr->aclexport); free(dstr); @@ -177,14 +178,13 @@ if (groupp == (struct group *)NULL) { /* put in gid instead */ (void) sprintf(where, "%d", aclp->a_id); + UPDATE_WHERE; } else { excess = strlen(groupp->gr_name) - LOGNAME_MAX; if (excess > 0) { rtn = increase_length(dstr, excess); if (rtn == 1) { - /* reset where */ - where = dstr->aclexport + - strlen(dstr->aclexport); + UPDATE_WHERE; } else { free(dstr->aclexport); free(dstr);