[asterisk-bugs] [JIRA] (ASTERISK-22010) if (sscanf()) - sscan returns -1 on a white-space only string

Rusty Newton (JIRA) noreply at issues.asterisk.org
Thu Jul 4 13:49:03 CDT 2013


     [ https://issues.asterisk.org/jira/browse/ASTERISK-22010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rusty Newton updated ASTERISK-22010:
------------------------------------

    Status: Open  (was: Triage)
    
> if (sscanf()) - sscan returns -1 on a white-space only string
> -------------------------------------------------------------
>
>                 Key: ASTERISK-22010
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-22010
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>    Affects Versions: SVN, 11.4.0
>            Reporter: Tzafrir Cohen
>         Attachments: asterisk-11-393395-sscanf_fix_chan_sip.diff, asterisk-11-393395-sscanf_fix.diff
>
>
> The man page for sscanf claims that its return value is the number of elements scanned. A number of places in the code of Asterisk rely on that and test the success of sscanf with the likes of: if (sscanf(str, ...)) .
> However, if the input string of sscanf is empty (or generally: only white-spaces), it will return -1, and not 0, and thus the above test will return erroneously succeed.
> The attached patch demonstrates this by fixing those issues in chan_sip.c in asterisk-11 . It also marks all the places where the return value of sscanf is not checked. At first glance I believe at least one of them needs checking.

--
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