[analyzer] Change the warning to suggest 'strlcat/strlcpy' as

replacements for 'starcat/strcpy' instead of 'strncat/strncpy'.

llvm-svn: 149406
This commit is contained in:
Anna Zaks 2012-01-31 19:33:31 +00:00
parent ebaefe7527
commit ee5e8ae845
2 changed files with 4 additions and 4 deletions

View File

@ -516,7 +516,7 @@ void WalkAST::checkCall_strcpy(const CallExpr *CE, const FunctionDecl *FD) {
"Call to function 'strcpy' is insecure as it does not "
"provide bounding of the memory buffer. Replace "
"unbounded copy functions with analogous functions that "
"support length arguments such as 'strncpy'. CWE-119.",
"support length arguments such as 'strlcpy'. CWE-119.",
CELoc, &R, 1);
}
@ -543,7 +543,7 @@ void WalkAST::checkCall_strcat(const CallExpr *CE, const FunctionDecl *FD) {
"Call to function 'strcat' is insecure as it does not "
"provide bounding of the memory buffer. Replace "
"unbounded copy functions with analogous functions that "
"support length arguments such as 'strncat'. CWE-119.",
"support length arguments such as 'strlcat'. CWE-119.",
CELoc, &R, 1);
}

View File

@ -138,7 +138,7 @@ void test_strcpy() {
char x[4];
char *y;
strcpy(x, y); //expected-warning{{Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strncpy'. CWE-119.}}
strcpy(x, y); //expected-warning{{Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119.}}
}
//===----------------------------------------------------------------------===
@ -162,7 +162,7 @@ void test_strcat() {
char x[4];
char *y;
strcat(x, y); //expected-warning{{Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strncat'. CWE-119.}}
strcat(x, y); //expected-warning{{Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcat'. CWE-119.}}
}
//===----------------------------------------------------------------------===