Home | History | Annotate | Download | only in Analysis

Lines Matching defs:NULL

1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.cstring,alpha.unix.cstring,debug.ExprInspection -analyzer-store=region -Wno-null-dereference -verify %s
2 // RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,unix.cstring,alpha.unix.cstring,debug.ExprInspection -analyzer-store=region -Wno-null-dereference -verify %s
3 // RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,unix.cstring,alpha.unix.cstring,debug.ExprInspection -analyzer-store=region -Wno-null-dereference -verify %s
4 // RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=alpha.security.taint,core,unix.cstring,alpha.unix.cstring,debug.ExprInspection -analyzer-store=region -Wno-null-dereference -verify %s
27 #define NULL 0
59 return strlen(0); // expected-warning{{Null pointer argument in call to string length function}}
63 return strlen((char*)&strlen_fn); // expected-warning{{Argument to string length function is the address of the function 'strlen_fn', which is not a null-terminated string}}
68 return strlen((char*)&&label); // expected-warning{{Argument to string length function is the address of the label 'label', which is not a null-terminated string}}
196 return strnlen(0, 3); // expected-warning{{Null pointer argument in call to string length function}}
200 return strnlen((char*)&strlen_fn, 3); // expected-warning{{Argument to string length function is the address of the function 'strlen_fn', which is not a null-terminated string}}
205 return strnlen((char*)&&label, 3); // expected-warning{{Argument to string length function is the address of the label 'label', which is not a null-terminated string}}
210 clang_analyzer_eval(strnlen(NULL, 0) == 0); // expected-warning{{TRUE}}
267 strcpy(NULL, x); // expected-warning{{Null pointer argument in call to string copy function}}
271 strcpy(x, NULL); // expected-warning{{Null pointer argument in call to string copy function}}
275 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}}
279 strcpy(x, (const 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}}
365 strcat(NULL, x); // expected-warning{{Null pointer argument in call to string copy function}}
369 strcat(x, NULL); // expected-warning{{Null pointer argument in call to string copy function}}
373 strcat(x, (char*)&strcat_fn); // expected-warning{{Argument to string copy function is the address of the function 'strcat_fn', which is not a null-terminated string}}
462 strncpy(NULL, x, 5); // expected-warning{{Null pointer argument in call to string copy function}}
466 strncpy(x, NULL, 5); // expected-warning{{Null pointer argument in call to string copy function}}
470 strncpy(x, (char*)&strcpy_fn, 5); // expected-warning{{Argument to string copy function is the address of the function 'strcpy_fn', which is not a null-terminated string}}
518 // strncpy does not null-terminate, so we have no idea what the strlen is
554 strncat(NULL, x, 4); // expected-warning{{Null pointer argument in call to string copy function}}
558 strncat(x, NULL, 4); // expected-warning{{Null pointer argument in call to string copy function}}
562 strncat(x, (char*)&strncat_fn, 4); // expected-warning{{Argument to string copy function is the address of the function 'strncat_fn', which is not a null-terminated string}}
728 char *x = NULL;
730 strcmp(x, y); // expected-warning{{Null pointer argument in call to string comparison function}}
735 char *y = NULL;
736 strcmp(x, y); // expected-warning{{Null pointer argument in call to string comparison function}}
837 char *x = NULL;
839 strncmp(x, y, 3); // expected-warning{{Null pointer argument in call to string comparison function}}
844 char *y = NULL;
845 strncmp(x, y, 3); // expected-warning{{Null pointer argument in call to string comparison function}}
946 char *x = NULL;
948 strcasecmp(x, y); // expected-warning{{Null pointer argument in call to string comparison function}}
953 char *y = NULL;
954 strcasecmp(x, y); // expected-warning{{Null pointer argument in call to string comparison function}}
1037 char *x = NULL;
1039 strncasecmp(x, y, 3); // expected-warning{{Null pointer argument in call to string comparison function}}
1044 char *y = NULL;
1045 strncasecmp(x, y, 3); // expected-warning{{Null pointer argument in call to string comparison function}}
1101 strsep(&s, NULL); // expected-warning{{Null pointer argument in call to strsep()}}
1105 strsep(NULL, ""); // expected-warning{{Null pointer argument in call to strsep()}}
1115 char *s = NULL;
1117 clang_analyzer_eval(result == NULL); // expected-warning{{TRUE}}
1124 clang_analyzer_eval(s == NULL); // expected-warning{{UNKNOWN}}
1127 if (s == NULL) {
1128 clang_analyzer_eval(s == NULL); // expected-warning{{TRUE}}