Coder Social home page Coder Social logo

Comments (2)

github-learning-lab avatar github-learning-lab commented on August 12, 2024

⌨️ Activity: Find all ntoh* macros

  1. Edit the file 5_macro_definitions.ql
  2. Write a query that finds the definitions of the macros named ntohs, ntohl or ntohll. Use the auto-completion in the Visual Studio Code extension to guide you:
    • Wait a moment after typing from to get a list of available classes in the CodeQL standard library for C/C++. Which class in this list represents macros? Create a variable with this class as its type.
    • In the where section, type <your_variable_name> followed by a dot ., and wait a moment to get the list of predicates available for a value in the variable's type. Hover over each predicate to see the inline documentation.
    • Which predicate will give us the name of a macro?
    • Use the or keyword to combine multiple conditions where you want at least one condition to be met. Here we are interested in three possible macro names.
  3. You can use a regular expression to write a more compact query that searches for all three macros at once, instead of using three cases combined by or. Check out the predicate string::regexpMatch in the built-in predicates for string. CodeQL uses the java.util.Pattern regexp conventions).
  4. Once you're happy with the results, submit your solution.

from codeql-uboot.

github-learning-lab avatar github-learning-lab commented on August 12, 2024

Congratulations, looks like the query you introduced in 172d25c finds the correct results!

If you created a pull request, merge it.

Let's continue to the next step.

from codeql-uboot.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.