[cfe-commits] r149406 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp test/Analysis/security-syntax-checks.m
Anna Zaks
ganna at apple.com
Tue Jan 31 11:33:31 PST 2012
Author: zaks
Date: Tue Jan 31 13:33:31 2012
New Revision: 149406
URL: http://llvm.org/viewvc/llvm-project?rev=149406&view=rev
Log:
[analyzer] Change the warning to suggest 'strlcat/strlcpy' as
replacements for 'starcat/strcpy' instead of 'strncat/strncpy'.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
cfe/trunk/test/Analysis/security-syntax-checks.m
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp?rev=149406&r1=149405&r2=149406&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp Tue Jan 31 13:33:31 2012
@@ -516,7 +516,7 @@
"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 @@
"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);
}
Modified: cfe/trunk/test/Analysis/security-syntax-checks.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/security-syntax-checks.m?rev=149406&r1=149405&r2=149406&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/security-syntax-checks.m (original)
+++ cfe/trunk/test/Analysis/security-syntax-checks.m Tue Jan 31 13:33:31 2012
@@ -138,7 +138,7 @@
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 @@
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.}}
}
//===----------------------------------------------------------------------===
More information about the cfe-commits
mailing list