diff options
Diffstat (limited to 'clang/test/Analysis/security-syntax-checks.c')
| -rw-r--r-- | clang/test/Analysis/security-syntax-checks.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Analysis/security-syntax-checks.c b/clang/test/Analysis/security-syntax-checks.c new file mode 100644 index 00000000000..25ce8b1b882 --- /dev/null +++ b/clang/test/Analysis/security-syntax-checks.c @@ -0,0 +1,8 @@ +// RUN: %clang_analyze_cc1 %s -verify \ +// RUN: -analyzer-checker=security.insecureAPI + +void builtin_function_call_crash_fixes(char *c) { + __builtin_strncpy(c, "", 6); // expected-warning{{Call to function 'strncpy' is insecure as it does not provide security checks introduced in the C11 standard.}} + __builtin_memset(c, '\0', (0)); // expected-warning{{Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard.}} + __builtin_memcpy(c, c, 0); // expected-warning{{Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard.}} +} |

