-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
f4139ed
There was a problem hiding this comment.
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
andf4139ed
after push torefs/heads/step-3
:9_class_network_byteswap.ql
Results for
9_class_network_byteswap.ql
: correct (107 results)f4139ed
There was a problem hiding this comment.
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.