diff options
Diffstat (limited to 'test/Analysis/cstring-syntax.c')
-rw-r--r-- | test/Analysis/cstring-syntax.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/Analysis/cstring-syntax.c b/test/Analysis/cstring-syntax.c index 4aa88ed3b7ed9..313ac54495408 100644 --- a/test/Analysis/cstring-syntax.c +++ b/test/Analysis/cstring-syntax.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=unix.cstring.BadSizeArg -analyzer-store=region -Wno-strncat-size -Wno-strlcpy-strlcat-size -Wno-sizeof-array-argument -Wno-sizeof-pointer-memaccess -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=unix.cstring.BadSizeArg -analyzer-store=region -Wno-strncat-size -Wno-strlcpy-strlcat-size -Wno-sizeof-array-argument -Wno-sizeof-pointer-memaccess -verify %s typedef __SIZE_TYPE__ size_t; char *strncat(char *, const char *, size_t); @@ -10,4 +10,6 @@ void testStrncat(const char *src) { strncat(dest, "AAAAAAAAAAAAAAAAAAAAAAAAAAA", sizeof(dest)); // expected-warning {{Potential buffer overflow. Replace with}} strncat(dest, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", sizeof(dest) - strlen(dest)); // expected-warning {{Potential buffer overflow. Replace with}} strncat(dest, src, sizeof(src)); // expected-warning {{Potential buffer overflow. Replace with}} + // Should not crash when sizeof has a type argument. + strncat(dest, "AAAAAAAAAAAAAAAAAAAAAAAAAAA", sizeof(char)); } |