summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/bsd-string.c
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2018-05-23 04:38:25 +0000
committerDavid Carlier <devnexen@gmail.com>2018-05-23 04:38:25 +0000
commit3c90fcebd4adebe2bb5d4fd91379348510951ec9 (patch)
tree853002527c04f708b5a5376b4f7cfffcbf59d90a /clang/test/Analysis/bsd-string.c
parent5764db4e57e217b2ecaa6c9800ec98edc2a5e7c2 (diff)
downloadbcm5719-llvm-3c90fcebd4adebe2bb5d4fd91379348510951ec9.tar.gz
bcm5719-llvm-3c90fcebd4adebe2bb5d4fd91379348510951ec9.zip
[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 llvm-svn: 333060
Diffstat (limited to 'clang/test/Analysis/bsd-string.c')
-rw-r--r--clang/test/Analysis/bsd-string.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Analysis/bsd-string.c b/clang/test/Analysis/bsd-string.c
index 4c57c86f174..14e1b00fc00 100644
--- a/clang/test/Analysis/bsd-string.c
+++ b/clang/test/Analysis/bsd-string.c
@@ -38,3 +38,8 @@ void f6() {
size_t len = strlcat(buf, "defg", 4);
clang_analyzer_eval(len == 7); // expected-warning{{TRUE}}
}
+
+int f7() {
+ char buf[8];
+ return strlcpy(buf, "1234567", 0); // no-crash
+}
OpenPOWER on IntegriCloud