c
SSIZE_T ConvertUtf8NToWChar(const char* str, size_t len, WCHAR* wstr, size_t wlen)
{
    // ... (existing code)

    WINPR_ASSERT(str); // Keep this for the destination buffer
    size_t ilen = (str) ? strnlen(str, len) : 0; // Conditional strnlen
    // ... (rest of the function)
}
