[PATCH] D45177: CStringChecker, check strlcpy/strlcat
David CARLIER via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 17 00:47:06 PDT 2018
devnexen added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:1560-1566
// If the size is known to be zero, we're done.
if (StateZeroSize && !StateNonZeroSize) {
StateZeroSize = StateZeroSize->BindExpr(CE, LCtx, DstVal);
C.addTransition(StateZeroSize);
return;
}
----------------
NoQ wrote:
> One more cornercase where the return value needs to be corrected. It'd be great to de-duplicate this code to avoid similar problems in the future.
>
> Test case:
> ```
> int foo(char *dst, const char *src) {
> return strlcpy(dst, src, 0); // no-crash
> }
> ```
Thanks for the hint ! will do a separate "PR".
Repository:
rC Clang
https://reviews.llvm.org/D45177
More information about the cfe-commits
mailing list