[Libwebsockets] Issue with lws_b64_decode_string in some cases - what's wrong ?

Shmuel Weiss sweiss at kramerel.com
Wed Aug 3 16:40:50 CEST 2016


Hi Andy,

Strange issue with lws_b64_decode_string:

Look at this Authorization field into an HTTP header "Basic QWRtaW46a2xvaWtsb2k="

After decrypt using lws_b64_decode_string  I got: "Admin:kloikloi,"

This should be "Admin:kloikloi" without the comma at the end. (you can check with https://www.base64decode.org/)

Can you please check ? (I have compiled the code for arm on BBB 32bits using gcc4.9 linaro)
This problem is not reproducible with all the strings, just in some cases I am getting an extra character.
IN this example, I am getting always this extra character.

My code:
myValidateFunc()
{
    static char login[64];
    memset(login,0,sizeof(login));
    std::string login_field="QWRtaW46a2xvaWtsb2k=";
    int n = lws_b64_decode_string(login_field.c_str(),login,sizeof(login));
    printf("%s",login);

}

I am using v2.0.0-91-gaf0b051 of libwebsockets

Thanks.

Sam.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20160803/9fa4bd88/attachment.html>


More information about the Libwebsockets mailing list