| 3568 | } |
| 3569 | |
| 3570 | static void *win_token_user_query(win_security_t *security, HANDLE token, PSID *sid_out) { |
| 3571 | DWORD needed = 0; |
| 3572 | (void)security->get_token_information(token, TokenUser, NULL, 0, &needed); |
| 3573 | if (needed == 0 || GetLastError() != ERROR_INSUFFICIENT_BUFFER) { |
| 3574 | return NULL; |
| 3575 | } |
| 3576 | /* The dynamically-resolved GetTokenInformation call initializes this |
| 3577 | * buffer on success. Zero-initialize it as defense in depth and so |
| 3578 | * static analysis does not have to infer writes through a function |
| 3579 | * pointer before TOKEN_USER is inspected. */ |
| 3580 | void *buffer = calloc(1, needed); |
| 3581 | if (!buffer || !security->get_token_information(token, TokenUser, buffer, needed, &needed)) { |
| 3582 | free(buffer); |
| 3583 | return NULL; |
| 3584 | } |
| 3585 | *sid_out = ((TOKEN_USER *)buffer)->User.Sid; |
| 3586 | return buffer; |
| 3587 | } |
| 3588 | |
| 3589 | #define RESOLVE_ADVAPI_MEMBER(context, member, type, symbol) \ |
| 3590 | do { \ |
no outgoing calls
no test coverage detected