[cfe-commits] r151120 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp test/Analysis/taint-generic.c
Anna Zaks
ganna at apple.com
Tue Feb 21 18:35:58 PST 2012
Author: zaks
Date: Tue Feb 21 20:35:58 2012
New Revision: 151120
URL: http://llvm.org/viewvc/llvm-project?rev=151120&view=rev
Log:
[analyzer] Change naming in bug reports "tainted" -> "untrusted"
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
cfe/trunk/test/Analysis/taint-generic.c
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp?rev=151120&r1=151119&r2=151120&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp Tue Feb 21 20:35:58 2012
@@ -45,7 +45,7 @@
mutable OwningPtr<BugType> BT;
inline void initBugType() const {
if (!BT)
- BT.reset(new BugType("Taint Analysis", "General"));
+ BT.reset(new BugType("Use of Untrusted Data", "Untrusted Data"));
}
/// \brief Catch taint related bugs. Check if tainted data is passed to a
@@ -174,14 +174,15 @@
const unsigned GenericTaintChecker::InvalidArgIndex;
const char GenericTaintChecker::MsgUncontrolledFormatString[] =
- "Tainted format string (CWE-134: Uncontrolled Format String)";
+ "Untrusted data is used as a format string "
+ "(CWE-134: Uncontrolled Format String)";
const char GenericTaintChecker::MsgSanitizeSystemArgs[] =
- "Tainted data passed to a system call "
+ "Untrusted data is passed to a system call "
"(CERT/STR02-C. Sanitize data passed to complex subsystems)";
const char GenericTaintChecker::MsgTaintedBufferSize[] =
- "Tainted data is used to specify the buffer size "
+ "Untrusted data is used to specify the buffer size "
"(CERT/STR31-C. Guarantee that storage for strings has sufficient space for "
"character data and the null terminator)";
Modified: cfe/trunk/test/Analysis/taint-generic.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/taint-generic.c?rev=151120&r1=151119&r2=151120&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/taint-generic.c (original)
+++ cfe/trunk/test/Analysis/taint-generic.c Tue Feb 21 20:35:58 2012
@@ -111,11 +111,11 @@
char buffer[156];
char addr[128];
scanf("%s", addr);
- system(addr); // expected-warning {{Tainted data passed to a system call}}
+ system(addr); // expected-warning {{Untrusted data is passed to a system call}}
// Test that spintf transfers taint.
sprintf(buffer, "/bin/mail %s < /tmp/email", addr);
- system(buffer); // expected-warning {{Tainted data passed to a system call}}
+ system(buffer); // expected-warning {{Untrusted data is passed to a system call}}
}
void testTaintSystemCall2() {
@@ -124,7 +124,7 @@
char addr[128];
scanf("%s", addr);
__builtin_snprintf(buffern, 10, "/bin/mail %s < /tmp/email", addr);
- system(buffern); // expected-warning {{Tainted data passed to a system call}}
+ system(buffern); // expected-warning {{Untrusted data is passed to a system call}}
}
void testTaintSystemCall3() {
@@ -133,20 +133,20 @@
char addr[128];
scanf("%s %d", addr, &numt);
__builtin_snprintf(buffern2, numt, "/bin/mail %s < /tmp/email", "abcd");
- system(buffern2); // expected-warning {{Tainted data passed to a system call}}
+ system(buffern2); // expected-warning {{Untrusted data is passed to a system call}}
}
void testTaintedBufferSize() {
size_t ts;
scanf("%zd", &ts);
- int *buf1 = (int*)malloc(ts*sizeof(int)); // expected-warning {{Tainted data is used to specify the buffer size}}
- char *dst = (char*)calloc(ts, sizeof(char)); //expected-warning {{Tainted data is used to specify the buffer size}}
- bcopy(buf1, dst, ts); // expected-warning {{Tainted data is used to specify the buffer size}}
- __builtin_memcpy(dst, buf1, (ts + 4)*sizeof(char)); // expected-warning {{Tainted data is used to specify the buffer size}}
+ int *buf1 = (int*)malloc(ts*sizeof(int)); // expected-warning {{Untrusted data is used to specify the buffer size}}
+ char *dst = (char*)calloc(ts, sizeof(char)); //expected-warning {{Untrusted data is used to specify the buffer size}}
+ bcopy(buf1, dst, ts); // expected-warning {{Untrusted data is used to specify the buffer size}}
+ __builtin_memcpy(dst, buf1, (ts + 4)*sizeof(char)); // expected-warning {{Untrusted data is used to specify the buffer size}}
// If both buffers are trusted, do not issue a warning.
- char *dst2 = (char*)malloc(ts*sizeof(char)); // expected-warning {{Tainted data is used to specify the buffer size}}
+ char *dst2 = (char*)malloc(ts*sizeof(char)); // expected-warning {{Untrusted data is used to specify the buffer size}}
strncat(dst2, dst, ts); // no-warning
}
@@ -164,7 +164,7 @@
sock = socket(AF_INET, SOCK_STREAM, 0);
read(sock, buffer, 100);
- execl(buffer, "filename", 0); // expected-warning {{Tainted data passed to a system call}}
+ execl(buffer, "filename", 0); // expected-warning {{Untrusted data is passed to a system call}}
sock = socket(AF_LOCAL, SOCK_STREAM, 0);
read(sock, buffer, 100);
More information about the cfe-commits
mailing list