[asterisk-bugs] [JIRA] (ASTERISK-21854) Long Asterisk-version strings display improperly in the 'Connected to ...' line upon remote console connection

klaus3000 (JIRA) noreply at issues.asterisk.org
Thu Jun 6 10:43:03 CDT 2013


    [ https://issues.asterisk.org/jira/browse/ASTERISK-21854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=207059#comment-207059 ] 

klaus3000 commented on ASTERISK-21854:
--------------------------------------

I do not understand why this fix does not work for you.

Further, just increasing the buffer size is not a fix. The problem is, that read() starts after sizeof(buf) characters. If the string is longer than buf, then the terminating \0 is missing. Thus, my fix should be better:

1. char buf[80] = {0};

This initializes the whole array to \0 characters

2. if (read(ast_consock, buf, sizeof(buf)-1) < 0) {

This reads only 79 characters, thus keeps the last character as \0 (as long nobody else uses buf before the read command. So the string will be truncated, but is always \0 terminated.

This works fine for me with 11.4.0. Maybe you are using another version which uses "buf" after initialization, but before the read command.

                
> Long Asterisk-version strings display improperly in the 'Connected to ...' line upon remote console connection
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-21854
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-21854
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: General
>    Affects Versions: 11.4.0
>            Reporter: klaus3000
>            Severity: Minor
>
> When using a long version string in file ".version", the presented string when connecting to the Asterisk CLI looks corrupted. See following example: the string printed directly is correct, the "Connected to" string (which shows the version received via the socket from the server) is broken:
> {noformat}
> # rasterisk
> Asterisk 11.4.0 890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890, Copyright (C) 1999 - 2012 Digium, Inc. and others.
> Created by Mark Spencer <markster at digium.com>
> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
> This is free software, with components licensed under the GNU General Public
> License version 2 and other licenses; you are welcome to redistribute it under
> certain conditions. Type 'core show license' for details.
> =========================================================================
> Connected to Asterisk 11.4.0 89012345678901234567890123456789012345678901234567890123456789▒▒ ▒ currently running on hvst (pid = 28190)
> 0123456789012345678901234567890
> hvst*CLI>
> {noformat}
> The bug exists since version 1.4.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list