-
Notifications
You must be signed in to change notification settings - Fork 149
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
IKOS should tolerate snprintf(NULL, 0, ...)
#221
Comments
I could be wrong, but at first glance I think we'd need to change: ikos/analyzer/src/checker/null_dereference.cpp Lines 335 to 338 in ae8200b
so that |
Maybe handling the special case of argument 1 being the 0 constant would be fine for now since that seems like a common use case. |
snprintf(NULL, 0, ...)
snprintf(NULL, 0, ...)
snprintf(NULL, 0, ...)
ikos claims that the following C program is unsafe because of the null pointer passed to
snprintf()
:However, according to cppreference, when the second argument is
0
, the first argument is allowed to beNULL
.https://en.cppreference.com/w/c/io/fprintf
We use this feature to determine the number of characters that would be written before actually writing them.
The text was updated successfully, but these errors were encountered: