From 5fdadf4b643dd2f7a467244946dc1587b2f9ed1f Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Wed, 22 Feb 2012 02:35:58 +0000 Subject: [PATCH] [analyzer] Change naming in bug reports "tainted" -> "untrusted" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151120 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Checkers/GenericTaintChecker.cpp | 9 +++++---- test/Analysis/taint-generic.c | 20 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp index 9f3220056d..4490ddbcc0 100644 --- a/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp @@ -45,7 +45,7 @@ private: mutable OwningPtr 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::ReturnValueIndex; 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)"; diff --git a/test/Analysis/taint-generic.c b/test/Analysis/taint-generic.c index d52dcda5a1..b00372a3ff 100644 --- a/test/Analysis/taint-generic.c +++ b/test/Analysis/taint-generic.c @@ -111,11 +111,11 @@ void testTaintSystemCall() { 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 @@ void testTaintSystemCall2() { 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 @@ void testTaintSystemCall3() { 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 @@ void testSocket() { 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); -- 2.50.1