11 lines · c
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.ExprInspection5 6char *strcpy(char *restrict s1, const char *restrict s2);7 8void 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}11