-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incorrect return-value check for a scanf like function (CWE-253) #323
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked at the changes, and reviewed the sscanf
man page. This change seems correct, because only the return value of 1
represents matching the single expected value.
A value of 0 would mean that nothing matched the format string. The current code checks against this. A number greater than 1 seems unlikely with a format string that comprises a single conversion specification. In case of an error, EOF
could also be returned, but the current code would not catch this, I think.
Fix issue #324 |
|
I have looked at the changes again, IMHO they are "obviously correct", so I'll just go ahead and merge this. |
Giving an empty string instead of a number as option argument was not reliably caught, see GH issue schweikert#324 and GH PR schweikert#323.
Giving an empty string instead of a number as option argument was not reliably caught, see GH issue schweikert#324 and GH PR schweikert#323.
Giving an empty string instead of a number as option argument was not reliably caught, see GH issue schweikert#324 and GH PR schweikert#323.
Looks good to me as well. Thanks! |
This pull request fix the codeql security CWE-253 alert
Incorrect return-value check for a 'scanf'-like function