aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Analysis/string_notnullterm.c
blob: 9c6a6713e615b03fc2db79dc4093225b0f1581bf (plain)
1
2
3
4
5
6
7
8
9
10
// RUN: %clang_analyze_cc1 -verify %s -Wno-null-dereference \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-checker=unix.cstring.NotNullTerminated \
// RUN:   -analyzer-checker=debug.ExprInspection

char *strcpy(char *restrict s1, const char *restrict s2);

void strcpy_fn(char *x) {
  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}}
}