mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 04:48:36 +00:00
advapi32: Fix rewinding the last path segment in SetSecurityInfo().
In particular, handle the case where an object has no name. In theory, this should not happen for regular files, but SetSecurityInfo() is almost certainly not supposed to care about that [i.e. this code probably belongs in the server, at the very least]. However, fixing that will require much more work. While we're at it, rewrite the code to be a little more idiomatic about its intent.
This commit is contained in:
parent
3ecedb7e14
commit
c05973d077
|
@ -2969,10 +2969,11 @@ DWORD WINAPI SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType,
|
|||
return RtlNtStatusToDosError(status);
|
||||
}
|
||||
|
||||
for (name_info->Name.Length-=2; name_info->Name.Length>0; name_info->Name.Length-=2)
|
||||
if (name_info->Name.Buffer[name_info->Name.Length/2-1]=='\\' ||
|
||||
name_info->Name.Buffer[name_info->Name.Length/2-1]=='/')
|
||||
break;
|
||||
if (name_info->Name.Length && name_info->Name.Buffer[(name_info->Name.Length / 2) - 1] == '\\')
|
||||
name_info->Name.Length -= 2;
|
||||
while (name_info->Name.Length && name_info->Name.Buffer[(name_info->Name.Length / 2) - 1] != '\\')
|
||||
name_info->Name.Length -= 2;
|
||||
|
||||
if (name_info->Name.Length)
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
|
|
Loading…
Reference in a new issue