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

Tzafrir Cohen (JIRA) noreply at issues.asterisk.org
Thu Jul 4 07:01:03 CDT 2013


Tzafrir Cohen created ASTERISK-22010:
----------------------------------------

             Summary: 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: 11.4.0, SVN
            Reporter: Tzafrir Cohen


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