diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2017-01-09 14:02:19 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2017-01-09 14:02:19 +0100 |
commit | 838cfa352cf0d7146976af5548866393aeeb8862 (patch) | |
tree | 17faa1902917e7ce7976801eb18b73ff5fac4b3f | |
parent | 61f181d6b872e6f37b04fed790fa903a312a3795 (diff) | |
download | cygnal-838cfa352cf0d7146976af5548866393aeeb8862.tar.gz cygnal-838cfa352cf0d7146976af5548866393aeeb8862.tar.bz2 cygnal-838cfa352cf0d7146976af5548866393aeeb8862.zip |
Don't free statically allocated sys_privs
commit 67fd2101 introduced a bad bug. Changing sys_privs to a static
area and just returning a pointer is nice... *if* the calling code doesn't
call free() on it. Make sure callers check pointer for sys_privs and
refrain from calling free, if so.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/sec_auth.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc index 50823c613..d4c2701da 100644 --- a/winsup/cygwin/sec_auth.cc +++ b/winsup/cygwin/sec_auth.cc @@ -993,7 +993,7 @@ out: pop_self_privilege (); if (token != INVALID_HANDLE_VALUE) CloseHandle (token); - if (privs) + if (privs && privs != (PTOKEN_PRIVILEGES) &sys_privs) free (privs); lsa_close_policy (lsa); @@ -1229,7 +1229,7 @@ lsaauth (cygsid &usersid, user_groups &new_groups) user_token = get_full_privileged_inheritable_token (user_token); out: - if (privs) + if (privs && privs != (PTOKEN_PRIVILEGES) &sys_privs) free (privs); lsa_close_policy (lsa); if (lsa_hdl) |