| 3632 | } |
| 3633 | |
| 3634 | static void *win_token_user_query(win_security_t *security, HANDLE token, PSID *sid_out) { |
| 3635 | DWORD needed = 0; |
| 3636 | (void)security->get_token_information(token, TokenUser, NULL, 0, &needed); |
| 3637 | if (needed == 0 || GetLastError() != ERROR_INSUFFICIENT_BUFFER) { |
| 3638 | return NULL; |
| 3639 | } |
| 3640 | /* The dynamically-resolved GetTokenInformation call initializes this |
| 3641 | * buffer on success. Zero-initialize it as defense in depth and so |
| 3642 | * static analysis does not have to infer writes through a function |
| 3643 | * pointer before TOKEN_USER is inspected. */ |
| 3644 | void *buffer = calloc(1, needed); |
| 3645 | if (!buffer || !security->get_token_information(token, TokenUser, buffer, needed, &needed)) { |
| 3646 | free(buffer); |
| 3647 | return NULL; |
| 3648 | } |
| 3649 | *sid_out = ((TOKEN_USER *)buffer)->User.Sid; |
| 3650 | return buffer; |
| 3651 | } |
| 3652 | |
| 3653 | #define RESOLVE_ADVAPI_MEMBER(context, member, type, symbol) \ |
| 3654 | do { \ |
no outgoing calls
no test coverage detected