Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build

on: [push, pull_request]

jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install GCC
run: |
sudo apt-get update
sudo apt-get install -y gcc

- name: Compile all lab programs
run: |
gcc -Wall -Wextra -Werror src/vuln_buffer_overflow.c -o vuln_buffer_overflow
gcc -Wall -Wextra -Werror src/safe_input_demo.c -o safe_input_demo
gcc -Wall -Wextra -Werror src/stack_layout_demo.c -o stack_layout_demo
gcc -Wall -Wextra -Werror src/overflow_behavior_demo.c -o overflow_behavior_demo
gcc -Wall -Wextra -Werror src/control_flow_simulation.c -o control_flow_simulation
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@ vuln_lab
vuln_lab.exe
vuln_lab_test
vuln_lab_test.exe
stack_behavior_demo
stack_behavior_demo.exe
vuln_buffer_overflow
vuln_buffer_overflow.exe
safe_input_demo
safe_input_demo.exe
stack_layout_demo
stack_layout_demo.exe
overflow_behavior_demo
overflow_behavior_demo.exe
control_flow_simulation
control_flow_simulation.exe
*.exe
*.o
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
CC = gcc
CFLAGS = -Wall -Wextra -g -O0
TARGET = vuln_lab
SRC = src/main.c
VERIFY_CFLAGS = -Wall -Wextra -Werror
SRC_DIR = src
PROGRAMS = vuln_buffer_overflow safe_input_demo stack_layout_demo overflow_behavior_demo control_flow_simulation

.PHONY: all run clean
.PHONY: all verify clean

all: $(TARGET)
all: $(PROGRAMS)

$(TARGET): $(SRC)
$(CC) $(CFLAGS) -o $(TARGET) $(SRC)
$(PROGRAMS): %: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ $<

run: $(TARGET)
./$(TARGET)
verify: $(addprefix verify-,$(PROGRAMS))

verify-%: $(SRC_DIR)/%.c
$(CC) $(VERIFY_CFLAGS) -o $* $<

clean:
-$(RM) $(TARGET) $(TARGET).exe
-$(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS))
Loading
Loading