Bug 401284 - False positive "Source and destination overlap in strncat"
[valgrind.git] / memcheck / tests / bug401284.c
blob704ed52f296eaf036ed135fd91a1fefb98b84a35
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
5 int main(int argc, char* argv[])
7 size_t len = strlen(argv[1]);
8 char* buf = (char*) malloc(2 * len + 1);
9 memcpy(buf, argv[1], len + 1);
10 strncat(buf + len, buf, len);
11 printf("%s\n", buf);
12 free(buf);
13 return 0;