[asterisk-bugs] [JIRA] (ASTERISK-25272) The ICONV dialplan function somtetimes returns garbage

Etienne Lessard (JIRA) noreply at issues.asterisk.org
Wed Jul 22 06:56:33 CDT 2015


Etienne Lessard created ASTERISK-25272:
------------------------------------------

             Summary: The ICONV dialplan function somtetimes returns garbage
                 Key: ASTERISK-25272
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25272
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Functions/func_iconv
    Affects Versions: 13.4.0, 11.18.0
         Environment: Debian wheezy i686
            Reporter: Etienne Lessard
         Attachments: AST-25272.patch

Given I have the following extension:
{noformat}
exten = 12,1,NoOp()
same  =   n,Set(MSG=abcdefghijklmnopqrstuvwxyz)
same  =   n,NoOp(${ICONV(ASCII,ASCII,${MSG})})
same  =   n,Set(MSG=hello)
same  =   n,NoOp(${ICONV(ASCII,ASCII,${MSG})})
same  =   n,Hangup()
{noformat}
When I call this extension
Then I see in the Asterisk CLI:
{noformat}
-- Executing [12 at default:1] NoOp("SIP/gl0ezv-00000005", "") in new stack
-- Executing [12 at default:2] Set("SIP/gl0ezv-00000005", "MSG=abcdefghijklmnopqrstuvwxyz") in new stack
-- Executing [12 at default:3] NoOp("SIP/gl0ezv-00000005", "abcdefghijklmnopqrstuvwxyz") in new stack
-- Executing [12 at default:4] Set("SIP/gl0ezv-00000005", "MSG=hello") in new stack
-- Executing [12 at default:5] NoOp("SIP/gl0ezv-00000005", "hellofghijklmnopqrstuvwxyz") in new stack
{noformat}

Expected: the second call to ICONV (at priority 5) returns "hello" instead of
"hellofghijklmnopqrstuvwxyz".

There's other way to trigger the bug, but this dialplan is the easiest way I have found.

I've taken a look at func_iconv.c, and we can see that a null character is not appended at the end of the output string, and since the output string is not previously filled with null character, this bugs shows up.

I've attached a patch that I tested against the following scenarios:
* original test described in this issue
* converting "Valérie" from UTF-8 to ASCII//IGNORE
* converting "Valérie" from UTF-8 to ASCII

Thank you.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list