github / github/codeql

To trace variables changed

Aperta
#9,761 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.