Skip to content

Commit

Permalink
Seventh1 Query
Browse files Browse the repository at this point in the history
  • Loading branch information
Can MA authored and Can MA committed Nov 23, 2021
1 parent 7738bbe commit f4139ed
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions 9_class_network_byteswap.ql
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import cpp

/**
* An expression involved when swapping the byte order of network data.
* Its value is likely to have been read from the network.
*/
class NetworkByteSwap extends Expr {
NetworkByteSwap () {
// TODO: replace <class> and <var>
NetworkByteSwap() {
exists(MacroInvocation mi |
mi.getMacro().getName().regexpMatch("ntoh(s|l|ll)") and
this=mi.getExpr()
mi.getMacroName().regexpMatch("ntoh(s|l|ll)") and
this = mi.getExpr()
)
}
}

from NetworkByteSwap n
select n, "Network byte swap"
select n

2 comments on commit f4139ed

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 query changed between 7738bbe and f4139ed after push to refs/heads/step-3:

  • 9_class_network_byteswap.ql

Results for 9_class_network_byteswap.ql: correct (107 results)

@github-learning-lab
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations, looks like the query you introduced for step 9 finds the correct results!

Merge this Pull Request (unless you're on main), and take a look at the instructions for the next step to continue.

Please sign in to comment.