clang/test/Analysis/string_notnullterm.c
raw| 1 | // RUN: %clang_analyze_cc1 -verify %s -Wno-null-dereference \ |
| 2 | // RUN: -analyzer-checker=core \ |
| 3 | // RUN: -analyzer-checker=unix.cstring.NotNullTerminated \ |
| 4 | // RUN: -analyzer-checker=debug.ExprInspection |
| 5 | |
| 6 | char *strcpy(char *restrict s1, const char *restrict s2); |
| 7 | |
| 8 | void strcpy_fn(char *x) { |
| 9 | strcpy(x, (char*)&strcpy_fn); // expected-warning{{Argument to string copy function is the address of the function 'strcpy_fn', which is not a null-terminated string}} |
| 10 | } |