diff options
Diffstat (limited to 'test/Sema/warn-strncat-size.c')
-rw-r--r-- | test/Sema/warn-strncat-size.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/Sema/warn-strncat-size.c b/test/Sema/warn-strncat-size.c index 7157edf..dcc3367 100644 --- a/test/Sema/warn-strncat-size.c +++ b/test/Sema/warn-strncat-size.c @@ -59,7 +59,7 @@ void size_1() { char z[1]; char str[] = "hi"; - strncat(z, str, sizeof(z)); // expected-warning{{the value of the size argument in 'strncat' is too large, might lead to a buffer overflow}} + strncat(z, str, sizeof(z)); // expected-warning{{the value of the size argument to 'strncat' is wrong}} } // Support VLAs. @@ -69,3 +69,8 @@ void vlas(int size) { strncat(z, str, sizeof(str)); // expected-warning {{size argument in 'strncat' call appears to be size of the source}} expected-note {{change the argument to be the free space in the destination buffer minus the terminating null byte}} } + +// Non-array type gets a different error message. +void f(char* s, char* d) { + strncat(d, s, sizeof(d)); // expected-warning {{the value of the size argument to 'strncat' is wrong}} +} |