The linphone-desktop of windows version will crash if the sound card's name has Chinese characters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The linphone-desktop of windows version will crash if the sound card's name has Chinese characters

杨奇

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;

_______________________________________________
Linphone-developers mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/linphone-developers