| 1 |
// RUN: %clang_analyze_cc1 -w -analyzer-checker=unix.cstring.BadSizeArg \ |
| 2 |
// RUN: -verify %s |
| 3 |
|
| 4 |
// expected-no-diagnostics |
| 5 |
|
| 6 |
typedef __SIZE_TYPE__ size_t; |
| 7 |
// The last parameter is normally size_t but the test is about the abnormal |
| 8 |
// situation when it's not a size_t. |
| 9 |
size_t strlcpy(char *, const char *, void (*)(void)); |
| 10 |
|
| 11 |
void foo(void); |
| 12 |
|
| 13 |
void testWeirdDecls(const char *src) { |
| 14 |
char dst[10]; |
| 15 |
strlcpy(dst, src, foo); // no-crash |
| 16 |
strlcpy(dst, src, &foo); // no-crash |
| 17 |
} |