This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/LAUNCHXL-CC3235SF: sl_WlanGet() function response includes null character

Part Number: LAUNCHXL-CC3235SF

Tool/software: TI-RTOS

Hello everyone!

I want to ask about two Wlan functions "sl_WlanGet" and "sl_WlanProfileGet", by which I can get SSID for AP mode and SSID of AP in case of STA mode respectively. But format of response values are a bit different. In case of "sl_WlanProfileGet", function returns SSID and its length without regard null character '\0' in the end of string. However "sl_WlanGet" function returns SSID as null-terminated string and its length includes this null character. Although in documentation (dev.ti.com/.../group___wlan.html) returned SSID length is the same for both functions "Get up to 32 characters of SSID" and "Up to 32 bytes". But if I allocate memory for precise length without null character and specify parameter "pNameLen" as precise length of SSID name without regard to null termnated character, "sl_WlanGet" function will return error code "-2001" (SL_ESMALLBUF). And in case of "sl_WlanGetNetworkList" function, returned SSID names' lengths are without null charactes. I would like to clarify, why "sl_WlanGet" function includes null character, while its neighbor functions don't include?

And it seems there're some typos in your documentation. "sl_WlanGet" function has "pConfigOpt" parameter as input (not output, as it specified), and "pConfigLen" could be both input and output value (not only output), so it should be specified as [in,out], I suspect.

Best regards,
Roman

  • And yes, the same question relates WiFi passwords. When I "sl_WlanProfileGet" returns filled "SlWlanSecParams_t" structure, KeyLen equals 0. But "sl_WlanGet" function returns "pConfigLen" equals 1, when I require a password. Although in both cases the functions don't return passwords. It seems a bit strange, because they return similar data, but in one case function returns null-terminated string and its length like sizeof array char[], which include null character, and in another case function returns without null character and its length is like a result of strlen(), which return length without regard to null character.
  • Hi Roman,

    I'll take a look at the behavior and work to get the documentation updated as soon as possible. Thanks for the additional observations regarding the consistency in behavior with respect to the passwords. It seems you are familiar with this fact already - for others that read this post, it is expected that the API calls do not return the passwords for security reasons.

    Best,
    Ben M
  • Hi Roman,

    We will take the action to adjust the documentation. I'm going to close this thread for now.

    Best,
    Ben M
  • Hi Ben!

    Yes, thank you! I will be appreciated if you specify more clearly in your documentation where strings are null-terminated and where they are not. And it would be great if it was unified.

    Best regards,
    Roman