[PATCH] D45177: CStringChecker, check strlcpy/strlcat
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 16 11:29:52 PDT 2018
NoQ 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;
}
----------------
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
}
```
Repository:
rC Clang
https://reviews.llvm.org/D45177
More information about the cfe-commits
mailing list