================
@@ -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@-1 {{Taint propagated to the 
return value}}
-  if (size){ // expected-note {{Assuming 'size' is non-null}}
-                      // expected-note@-1 {{Taking true branch}}
-    pathbuf=(char*) malloc(atoi(size)); // expected-warning{{Untrusted data is 
used to specify the buffer size}}
-                                                // expected-note@-1{{Untrusted 
data is used to specify the buffer size}}
-                                                // expected-note@-2 {{Taint 
propagated to the return value}}
-    return pathbuf;
+int taintDiagnosticPropagation(){
+  int res;
+  char *cmd=getenv("CMD"); // expected-note {{Taint originated here}}
+                           // expected-note@-1 {{Taint propagated to the 
return value}}
+  if (cmd){ // expected-note {{Assuming 'cmd' is non-null}}
+                 // expected-note@-1 {{Taking true branch}}
----------------
NagyDonat wrote:

```suggestion
  if (cmd){ // expected-note {{Assuming 'cmd' is non-null}}
            // expected-note@-1 {{Taking true branch}}
```

https://github.com/llvm/llvm-project/pull/68607
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to