github / github/codeql

To trace variables changed

Đang mở
#9,761 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.