Commit Graph

3 Commits

Author SHA1 Message Date
David Carlier 73ce27a679 [CStringSyntaxChecker] Check strlcpy sizeof syntax
The last argument is expected to be the destination buffer size (or less).

    Detects if it points to destination buffer size directly or via a variable.
    Detects if it is an integral, try to detect if the destination buffer can receive the source length.

Updating bsd-string.c unit tests as it make it fails now.

Reviewers: george.karpenpov, NoQ

Reviewed By: george.karpenkov

Differential Revision: https://reviews.llvm.org/D48884


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337499 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-19 21:50:03 +00:00
David Carlier bb92f34ba2 [analyzer] CStringChecker fix for strlcpy when no bytes are copied to the dest buffer
Again, strlc* does not return a pointer so the zero size case doest not fit.

Reviewers: NoQ, george.karpenkov

Reviewed by: NoQ

Differential Revision: https://reviews.llvm.org/D47007


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333060 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-23 04:38:25 +00:00
Artem Dergachev a9d58a0e9d [analyzer] Re-apply r331096 "CStringChecker: Add support for BSD strlcpy()...".
Fixed after revert in r331401.

Patch by David Carlier!

Differential Revision: https://reviews.llvm.org/D45177


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332303 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 22:32:24 +00:00