Re: hex to binary conversion for xml post
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
why do you think, it should be a bug?
You see old code, new code:
/* text */
XPATH_SEARCH_OCTSTR("/message/submit/ud", text, 0);
if (text != NULL && octstr_hex_to_binary(text) == -1)
octstr_url_decode(text);
And this is simple, try hex encoding 12345 (0102030405) and set it as text.
Thanks,
Alexander Malysh
P.S. Changing this behavior will break existing setups and this for no good reason.
Am 02.03.2011 um 16:48 schrieb Nikos Balkanas:
> Hi,
>
> This is a bug. Code scans your text for any non-hex chars. Since all chars, 12345 are valid hex chars, it assumes that text is in hex and tries to decode it. It should be fixed to require the '%' for url-encoded hex chars.
>
> BR,
> Nikos
> ----- Original Message ----- From: Emanuele Carbone
> To: [email protected]
> Sent: Wednesday, March 02, 2011 4:08 PM
> Subject: hex to binary conversion for xml post
>
>
> Hi guys,
>
>
> i tried to send a simple sms with this text "12345" (without quotes). The request was done in XML POST and i have received a strange sequence of character. But if the same request is done in GET i receive the correct message. Smsbox when received a xml request extract the text so:
>
>
> /* text */
> text = NULL;
> get_tag(*body, octstr_imm("ud"), &tmp, 0, 0);
> if(tmp) {
> O_DESTROY(text);
> text = octstr_duplicate(tmp);
> if(octstr_hex_to_binary(text) == -1)
> octstr_url_decode(text);
> O_DESTROY(tmp);
> }
>
>
> with the text 12345: (but it is true for the all hex symbols)
>
>
> octstr_check_range(ostr, 0, ostr->len, gw_isxdigit) is valid
>
>
> and the function convert ascii data to binary values. This action compromise my text.
>
>
> I don't understand why for xml request smsbox do this check.
>
>
>
>
> Please, can anyone explain the reason?!
>
>
> thanks in advance
>