Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3de32e8

Browse files
committed
C++: Simplify introductory text and code.
1 parent e264bdd commit 3de32e8

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

docs/codeql/codeql-language-guides/advanced-dataflow-scenarios-cpp.rst

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,11 @@ In the dual situation where a read of a field is not visible to CodeQL, the data
2020
The setup
2121
---------
2222

23-
Consider the following scenario: We have a two structs, each containing two fields, and we have two types of ways of getting user input, and two places that data can end up in:
23+
Consider the following scenario: We have data coming out of ``user_input()`` and we want to figure out if that data can ever reach an argument of `sink`.
2424

2525
.. code-block:: cpp
26-
27-
struct A {
28-
const int *p;
29-
int x;
30-
};
31-
32-
struct B {
33-
A *a;
34-
int y;
35-
};
36-
3726
void sink(int);
3827
int user_input();
39-
void write_user_input_to(void *);
40-
void read_data(const void *);
4128
4229
A regular dataflow query such as the following query
4330

@@ -69,10 +56,20 @@ A regular dataflow query such as the following query
6956
where Flow::flowPath(source, sink)
7057
select sink.getNode(), source, sink, "Flow from user input to sink!"
7158
72-
will catch most things á la
59+
will catch most things such as
7360

7461
.. code-block:: cpp
7562
63+
struct A {
64+
const int *p;
65+
int x;
66+
};
67+
68+
struct B {
69+
A *a;
70+
int y;
71+
};
72+
7673
void fill_structure(B* b, const int* pu) {
7774
// ...
7875
b->a->p = pu;

0 commit comments

Comments
 (0)