[PATCH] D49722: [CStringSyntaxChecker] Check strlcat sizeof check
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 23 00:32:51 PDT 2018
MaskRay added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp:275
+ os << "sizeof(" << DstName << ")";
+ else
+ os << "sizeof(<destination buffer>)";
----------------
devnexen wrote:
> MaskRay wrote:
> > Why can't this `else if` case be folded into the `strlcpy` case? There are lots of duplication.
> >
> > `strlcpy` does not check `DstName.empty()` but this one does. Is there any cases I am missing?
> strlcpy does but agreed with your first statement, this handling case for both are more different than my initial plan defined them.
Not sure the description of `strlcat` should be different from `strlcpy`... For both of them, `len` should be less or equal to the size of `dst`. They may just use the same description.
I think your description of `strlcat` (`"The third argument allows to potentially copy more bytes than it should. ")` is better while the existing description of `strlcpy` is problematic:
os << "The third argument is larger than the size of the input buffer. ";
input => output
https://reviews.llvm.org/D49722
More information about the cfe-commits
mailing list