github / github/codeql

To trace variables changed

Ouverte
#9,761 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
question
Langage dominant
CodeQL
Étoiles
10.1k
Forks
2.1k
Merge moyen
2 j 15 h
PR mergées (30 j)
141

Description

A snippet:
```
void impl_write_extend(int _b,int _c) {
printf("%d", _b);

if(_b>10 && _b<10) {

_b = 10;
}

_c = 20;
}

void impl_write(int _a) {
_a = 30;
impl_write_extend(_a, _a);
}
```

I expected to make a following path :

> 1. impl_write(int _a)
> 2. _a = 30
> 3. impl_write_extend(_a, _a)
> 4. void impl_write_extend(int _b,int _c)
> 5. if(_b>10 && _b<10)
> 6. _b = 10;

A below query is not working as my intention:

```
import cpp
import semmle.code.cpp.dataflow.TaintTracking
import semmle.code.cpp.security.Security
import DataFlow::PathGraph

class VA_TO_VA extends TaintTracking::Configuration {
VA_TO_VA() { this = "VA_TO_VA" }

override predicate isSource(DataFlow::Node source) {

exists(VariableAccess va|
va = source.asExpr()
)
}

override predicate isSink(DataFlow::Node node) {
exists(AssignExpr ae|
ae.getLValue() = node.asExpr()
)
}
}

from DataFlow::PathNode source, DataFlow::PathNode sink, VA_TO_VA config
where config.hasFlowPath(source, sink)
select sink, source, sink, "VA_TO_VA"
```

AssignExpr can not be used as a node in the tainted flow?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.