#define NULL ((void *)0)
typedef __typeof(sizeof(int)) size_t;
size_t strlcpy(char *dst, const char *src, size_t n);
size_t strlcat(char *dst, const char *src, size_t n);
size_t strlen(const char *s);
void clang_analyzer_eval(int);
void f1(void) {
char overlap[] = "123456789";
strlcpy(overlap, overlap + 1, 3); }
void f2(void) {
char buf[5];
size_t len;
len = strlcpy(buf, "abcd", sizeof(buf)); clang_analyzer_eval(len == 4); len = strlcat(buf, "efgh", sizeof(buf)); clang_analyzer_eval(len == 8); }
void f3(void) {
char dst[2];
const char *src = "abdef";
strlcpy(dst, src, 5); }
void f4(void) {
strlcpy(NULL, "abcdef", 6); }
void f5(void) {
strlcat(NULL, "abcdef", 6); }
void f6(void) {
char buf[8];
strlcpy(buf, "abc", 3);
size_t len = strlcat(buf, "defg", 4);
clang_analyzer_eval(len == 7); }
int f7(void) {
char buf[8];
return strlcpy(buf, "1234567", 0); }
void f8(void){
char buf[5];
size_t len;
len = strlcpy(buf,"123", sizeof(buf));
clang_analyzer_eval(len==3); len = strlen(buf);
clang_analyzer_eval(len==3);
len = strlcat(buf,"456", sizeof(buf));
clang_analyzer_eval(len==6); len = strlen(buf);
clang_analyzer_eval(len==4);
len = strlcat(buf,"789", 0);
clang_analyzer_eval(len==7); len = strlen(buf);
clang_analyzer_eval(len==4);
len = strlcpy(buf,"123",0);
clang_analyzer_eval(len==3); len = strlen(buf);
clang_analyzer_eval(len==4);
}
void f9(int unknown_size, char* unknown_src, char* unknown_dst){
char buf[8];
size_t len;
len = strlcpy(buf,"abba",sizeof(buf));
clang_analyzer_eval(len==4); clang_analyzer_eval(strlen(buf)==4);
len = strlcat(buf,"cd", unknown_size);
clang_analyzer_eval(len==6); clang_analyzer_eval(strlen(buf)>=4);
len = strlcpy(unknown_dst,"abbc",unknown_size);
clang_analyzer_eval(len==4); clang_analyzer_eval(strlen(unknown_dst));
len = strlcpy(buf,unknown_src, sizeof(buf));
clang_analyzer_eval(len); clang_analyzer_eval(strlen(buf));
len = strlcpy(unknown_dst, unknown_src, unknown_size);
clang_analyzer_eval(len); clang_analyzer_eval(strlen(unknown_dst));
len = strlcat(buf + 2, unknown_src + 1, sizeof(buf));
}
void f10(void){
char buf[8];
size_t len;
len = strlcpy(buf,"abba",sizeof(buf));
clang_analyzer_eval(len==4); strlcat(buf, "efghi", 9);
}
void f11(void) {
char a[256], b[256];
strlcpy(a, "world", sizeof(a));
strlcpy(b, "hello ", sizeof(b));
strlcat(b, a, sizeof(b)); }
int a, b;
void unknown_val_crash(void) {
strlcat(&b, a, 0); }