Skip to content

Commit 0104830

Browse files
committed
from...where...select with class
1 parent e6b23a9 commit 0104830

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

add-user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int main(int argc, char* argv[]) {
9393
info = get_user_info();
9494
id = get_new_id();
9595
write_info(id, info);
96-
free(info);
96+
free(info);
9797
/*
9898
* show_info(id);
9999
*/

session.ql

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import cpp
32

43
// 1. invalid input -- source
@@ -9,14 +8,22 @@ import cpp
98
//
109
// 3. drops table -- sink
1110
// rc = sqlite3_exec(db, query, NULL, 0, &zErrMsg);
12-
1311
// All predicates and classes are using one of:
1412
// AST Abstract syntax tree
1513
// CFG Control flow graph
1614
// DFG Data flow graph
1715
// Type hierarchy
16+
class DataSource extends VariableAccess {
17+
DataSource() {
18+
exists(FunctionCall read |
19+
read.getTarget().getName() = "read" and
20+
read.getArgument(1) = this
21+
)
22+
}
23+
}
1824

1925
from FunctionCall read, VariableAccess buf
20-
where read.getTarget().getName() = "read" and
21-
read.getArgument(1) = buf
26+
where
27+
read.getTarget().getName() = "read" and
28+
read.getArgument(1) = buf
2229
select buf

0 commit comments

Comments
 (0)