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
sizeof
I have some code like this:
unsigned long foo() { char buf[1]; return sizeof(buf[0]); }
My understanding is that buf[0] is actually not accessing the buffer, sizeof will just get the sizeof the type without any memory access. Yet this query still returns it as a result:
buf[0]
import cpp import semmle.code.cpp.security.BufferAccess from BufferAccess ba select ba
Is this intended? It results in a few false positives in my queries.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have some code like this:
My understanding is that
buf[0]is actually not accessing the buffer,sizeofwill just get the sizeof the type without any memory access. Yet this query still returns it as a result:Is this intended? It results in a few false positives in my queries.
The text was updated successfully, but these errors were encountered: