c
size_t max_alloc_size = MAX_SAFE_LENGTH * sizeof(WCHAR);
if (*pLength > max_alloc_size / sizeof(WCHAR)) {
    // Handle error or return an error code
}
char* utf8 = ConvertWCharNToUtf8Alloc(wchar, *pLength, &utf8_len);
