linphone-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-users] Fwd: The linphone-desktop of windows version will crash


From: 杨奇
Subject: [Linphone-users] Fwd: The linphone-desktop of windows version will crash if the sound card's name has Chinese characters
Date: Tue, 12 May 2020 16:37:09 +0800



---------- Forwarded message ---------
From: 杨奇 <address@hidden>
Date: Sat, May 9, 2020 at 1:55 PM
Subject: The linphone-desktop of windows version will crash if the sound card's name has Chinese characters
To: <address@hidden>


I've created an issue at github, https://github.com/BelledonneCommunications/linphone-desktop/issues/363


The linphone-desktop of windows version will crash when open preferences if the sound card's name has Chinese characters. I build it by the master codes, and today's ci artifacts will crash too. I try to fix it by calling setlocale before wcstombs_s in add_or_update_card . And I think the inputlen variable was not calculated correctly. Hope you can fix it, thanks.

https://gitlab.linphone.org/BC/public/mswasapi/blob/master/mswasapi.cpp#L502

static void add_or_update_card(MSSndCardManager *m, bctbx_list_t **l, LPWSTR id, LPWSTR wname, EDataFlow data_flow) {
    MSSndCard *card;
    const bctbx_list_t *elem = *l;
    uint8_t capabilities = 0;
    char *idStr = NULL;
    char *nameStr = NULL;
    size_t inputlen;
    size_t returnlen;
    const char* locale = NULL;

    locale = setlocale(LC_ALL, "");
    if (locale) {
        setlocale(LC_ALL, locale);
    }

    inputlen = (wcslen(wname) + 1) * 2;
    nameStr = (char *)ms_malloc(inputlen);
    if (!nameStr || wcstombs_s(&returnlen, nameStr, inputlen, wname, inputlen) != 0) {
        ms_error("mswasapi: Cannot convert card name to multi-byte string.");
        goto error;
    }
    inputlen = (wcslen(id) + 1) * 2;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]