Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit 2bf987c

Browse files
authored
Merge pull request #22 from github/uboot
Uboot
2 parents fa99433 + e29f5e4 commit 2bf987c

23 files changed

+1113
-3
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,15 @@ jobs:
2727
run: cd courses/cpp/ctf-segv/image && ./publish.sh
2828
env:
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
publish-courses-cpp-u-boot:
32+
needs: publish-codeql-learninglab-check
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v1
37+
38+
- name: Build and Publish Course Docker Image
39+
run: cd courses/cpp/uboot/image && ./publish.sh
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

courses/cpp/uboot/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# CodeQL LearningLab Course Action Template
2+
3+
Copy this entire directory,
4+
and replace the following:
5+
6+
* Replace `<owner>`, `<repo>` and `<pkg>` in the `image` property in
7+
[`action.yml`](action.yml) to reference the correct repository
8+
where the docker image will be published,
9+
and with a package name of your choice.
10+
(For courses in this repository,
11+
we use the convention of taking the course path,
12+
and replacing slashes with dashes,
13+
e.g. `courses/cpp/ctf-segv` becomes `courses-cpp-ctf-segv`)
14+
* Replace the zip file URL in [`image/Dockerfile`](image/Dockerfile)
15+
to point to the CodeQL database that will be used in your course.
16+
17+
After this,
18+
update [`answers/`](answers) and [`image/config/`](image/config)
19+
to add your model answers and expected query results as appropriate.

courses/cpp/uboot/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'Check queries'
2+
description: 'Check that the queries that have been pushed produce the correct results'
3+
author: 'GitHub <[email protected]>'
4+
runs:
5+
using: 'docker'
6+
image: 'docker://docker.pkg.github.com/github/codeql-learninglab-actions/courses-cpp-uboot'
7+
branding:
8+
icon: 'check-circle'
9+
color: 'purple'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @kind problem
3+
*/
4+
5+
import cpp
6+
7+
from Function f
8+
where f.getName() = "strlen"
9+
select f, "a function named strlen"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @kind problem
3+
*/
4+
5+
import cpp
6+
7+
from Function f
8+
where f.getName() = "memcpy"
9+
select f, "a function named memcpy"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @kind problem
3+
*/
4+
5+
import cpp
6+
7+
from Macro m
8+
where m.getName().regexpMatch("ntoh(s|ll?)")
9+
select m, "a macro reading from the network"
10+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @kind problem
3+
*/
4+
5+
import cpp
6+
7+
from Function f, FunctionCall fc
8+
where f.getName() = "memcpy" and
9+
fc.getTarget() = f
10+
select fc, "a call to memcpy"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @kind problem
3+
*/
4+
5+
import cpp
6+
7+
from Macro m, MacroInvocation mi
8+
where mi.getMacro() = m and m.getName().regexpMatch("ntoh(s|ll?)")
9+
select mi, "Invoking a macro reading from the network"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @kind problem
3+
*/
4+
5+
import cpp
6+
7+
from Macro m, MacroInvocation mi
8+
where mi.getMacro() = m and m.getName().regexpMatch("ntoh(s|ll?)")
9+
select mi.getExpr(), "Invoking a macro reading from the network"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @kind problem
3+
*/
4+
5+
import cpp
6+
7+
class NetworkRead extends Expr {
8+
NetworkRead() {
9+
exists (MacroInvocation mi | mi.getMacro().getName().regexpMatch("ntoh(s|ll?)") and this = mi.getExpr())
10+
}
11+
}
12+
13+
from NetworkRead n
14+
select n, "Reading from the network"

0 commit comments

Comments
 (0)