[clang] [analyzer] Removing untrusted buffer size taint warning (PR #68607)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Thu May 2 07:35:50 PDT 2024
================
@@ -53,34 +54,32 @@ void taintDiagnosticVLA(void) {
// Tests if the originated note is correctly placed even if the path is
// propagating through variables and expressions
-char *taintDiagnosticPropagation(){
- char *pathbuf;
- char *size=getenv("SIZE"); // expected-note {{Taint originated here}}
- // expected-note at -1 {{Taint propagated to the return value}}
- if (size){ // expected-note {{Assuming 'size' is non-null}}
- // expected-note at -1 {{Taking true branch}}
- pathbuf=(char*) malloc(atoi(size)); // expected-warning{{Untrusted data is used to specify the buffer size}}
- // expected-note at -1{{Untrusted data is used to specify the buffer size}}
- // expected-note at -2 {{Taint propagated to the return value}}
- return pathbuf;
+int taintDiagnosticPropagation(){
+ int res;
+ char *cmd=getenv("CMD"); // expected-note {{Taint originated here}}
+ // expected-note at -1 {{Taint propagated to the return value}}
+ if (cmd){ // expected-note {{Assuming 'cmd' is non-null}}
+ // expected-note at -1 {{Taking true branch}}
----------------
NagyDonat wrote:
```suggestion
if (cmd){ // expected-note {{Assuming 'cmd' is non-null}}
// expected-note at -1 {{Taking true branch}}
```
https://github.com/llvm/llvm-project/pull/68607
More information about the cfe-commits
mailing list