[asterisk-bugs] [JIRA] (ASTERISK-22012) if (sscanf()) - sscan returns -1 on a white-space only string
Rusty Newton (JIRA)
noreply at issues.asterisk.org
Thu Jul 4 13:49:04 CDT 2013
Rusty Newton created ASTERISK-22012:
---------------------------------------
Summary: if (sscanf()) - sscan returns -1 on a white-space only string
Key: ASTERISK-22012
URL: https://issues.asterisk.org/jira/browse/ASTERISK-22012
Project: Asterisk
Issue Type: Bug
Security Level: None
Affects Versions: SVN, 11.4.0
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