| 4320 | } |
| 4321 | |
| 4322 | static void *win_token_user_query(win_security_t *security, HANDLE token, PSID *sid_out) { |
| 4323 | DWORD needed = 0; |
| 4324 | (void)security->get_token_information(token, TokenUser, NULL, 0, &needed); |
| 4325 | if (needed == 0 || GetLastError() != ERROR_INSUFFICIENT_BUFFER) { |
| 4326 | return NULL; |
| 4327 | } |
| 4328 | /* The dynamically-resolved GetTokenInformation call initializes this |
| 4329 | * buffer on success. Zero-initialize it as defense in depth and so |
| 4330 | * static analysis does not have to infer writes through a function |
| 4331 | * pointer before TOKEN_USER is inspected. */ |
| 4332 | void *buffer = calloc(1, needed); |
| 4333 | if (!buffer || !security->get_token_information(token, TokenUser, buffer, needed, &needed)) { |
| 4334 | free(buffer); |
| 4335 | return NULL; |
| 4336 | } |
| 4337 | *sid_out = ((TOKEN_USER *)buffer)->User.Sid; |
| 4338 | return buffer; |
| 4339 | } |
| 4340 | |
| 4341 | #define RESOLVE_ADVAPI_MEMBER(context, member, type, symbol) \ |
| 4342 | do { \ |
no outgoing calls
no test coverage detected