Comments (2)
⌨️ Activity: Find all the calls to memcpy
- Edit the file
6_memcpy_calls.ql
- Use the auto-completion feature to find the class that represents function calls, and declare a variable that belongs to this class.
- Use auto-completion again on your function call variable to guess the predicate that tells us the target function that is being called.
- Combine this with your logic from step 4 to make sure the target function is named
memcpy
. - Once you're happy with the results, submit your solution.
Tip: You can have a look at the following C++ example. Note that your query will be simpler as you won't need to consider the declaringType
.
Finds calls to
std::map<...>::find()
import cpp from FunctionCall call, Function fcn where call.getTarget() = fcn and fcn.getDeclaringType().getSimpleName() = "map" and fcn.getDeclaringType().getNamespace().getName() = "std" and fcn.hasName("find") select call
Note: Once you have good results, you can try to make your query more compact by omitting the intermediate Function
variable. The 2 queries below are equivalent:
from Class1 c1, Class2 c2
where
c1.getClass2() = c2 and
c2.getProp() = "something"
select c1
from Class1 c1
where c1.getClass2().getProp() = "something"
select c1
from codeql-uboot.
Congratulations, looks like the query you introduced in a4433d1 finds the correct results!
If you created a pull request, merge it.
Let's continue to the next step.
from codeql-uboot.
Related Issues (9)
- Step 1 - Welcome to the course! HOT 1
- Step 2 - Set up your IDE HOT 2
- Step 3 - Your first query HOT 3
- Step 4 - Anatomy of a query HOT 2
- Step 5 - Using different classes and their predicates HOT 2
- Step 7 - Relating two variables, continued HOT 2
- Step 8 - Changing the selected output HOT 2
- Step 9 - Write your own class HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeql-uboot.