diff options
author | Bryan McLellan <btm@loftninjas.org> | 2019-04-12 11:04:43 -0400 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2019-04-12 11:04:43 -0400 |
commit | cffd09a534e79a28937f2d98c391e40861c17083 (patch) | |
tree | 7ba9a76d20ac2f73bcbb1dbcacdf16208e66ea3d | |
parent | bb4aa42621245fb89cd15a03a80362ada00c3aec (diff) | |
download | chef-cffd09a534e79a28937f2d98c391e40861c17083.tar.gz |
Raise error if EqualSid is not a pointerbtm/equal-sid
https://technet.microsoft.com/en-us/aa446622(v=vs.96)
> If either SID structure is not valid, the return value is undefined.
Debugging a segfault in #8365
Signed-off-by: Bryan McLellan <btm@loftninjas.org>
-rw-r--r-- | lib/chef/win32/security.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/chef/win32/security.rb b/lib/chef/win32/security.rb index 879aba7f2b..913e765696 100644 --- a/lib/chef/win32/security.rb +++ b/lib/chef/win32/security.rb @@ -179,9 +179,11 @@ class Chef end def self.equal_sid(sid1, sid2) - sid1 = sid1.pointer if sid1.respond_to?(:pointer) - sid2 = sid2.pointer if sid2.respond_to?(:pointer) - EqualSid(sid1, sid2) + if sid1.respond_to?(:pointer) && sid2.respond_to?(:pointer) + EqualSid(sid1.pointer, sid2.pointer) + else + Chef::ReservedNames::Win32::Error.raise! + end end def self.free_sid(sid) |