diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-05-27 15:58:49 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-05-27 15:58:49 +0400 |
commit | 74b2f73ea42e22f5d69fd23dd2440130b1564814 (patch) | |
tree | a378aac9424887df91fc4965c298aefc0c8d1205 /winsup/cygwin/security.cc | |
parent | 75bf29315323634e7e4258a9e1b417b5bd5d135c (diff) |
* security.cc (lsa2str): New function.
(get_priv_list): Call lsa2str instead of sys_wcstombs.
Diffstat (limited to 'winsup/cygwin/security.cc')
-rw-r--r-- | winsup/cygwin/security.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 3b577825c..b86432dd6 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -174,6 +174,15 @@ lsa2wchar (WCHAR *tgt, LSA_UNICODE_STRING &src, int size) tgt[size] = 0; } +static void +lsa2str (char *tgt, LSA_UNICODE_STRING &src, int size) +{ + if (src.Length / 2 < size) + size = src.Length / 2; + sys_wcstombs (tgt, src.Buffer, size); + tgt[size] = 0; +} + static LSA_HANDLE open_local_policy () { @@ -629,8 +638,7 @@ get_priv_list (LSA_HANDLE lsa, cygsid &usersid, cygsidlist &grp_list) PTOKEN_PRIVILEGES tmp; DWORD tmp_count; - sys_wcstombs (buf, privstrs[i].Buffer, - INTERNET_MAX_HOST_NAME_LENGTH + 1); + lsa2str (buf, privstrs[i], sizeof(buf) - 1); if (!LookupPrivilegeValue (NULL, buf, &priv)) continue; |