Skip to content
Snippets Groups Projects
Commit b63f73e4 authored by Ask Brandsnes Røsand's avatar Ask Brandsnes Røsand
Browse files

Update README.md

parent 6f495d5c
No related branches found
No related tags found
No related merge requests found
Pipeline #186367 passed
# Fuzzing example
# Øving 5
## Prerequisites
Gitlab link til prosjektet: https://gitlab.stud.idi.ntnu.no/askbr/nettverk-oving5-fuzzing
- Linux (preferably Arch Linux or an Arch Linux based distribution such as Manjaro) or MacOS
*Note: prosjektet er basert på eksempelet https://gitlab.com/ntnu-tdat3020/fuzzing-example*
## Instructions using [juCi++](https://gitlab.com/cppit/jucipp)
## Feil oppdaget
1. Clone this repository
2. Run juCi++ with the following arguments from a terminal:
- Linux: `CC=clang juci fuzzing-example`
- MacOS: `CC=/opt/homebrew/opt/llvm/bin/clang juci fuzzing-example`
3. Open `tests/utility_fuzzer_test.c` and run using either:
- Compile and Run in the Project menu
- Start/Continue in the Debug menu
### Address Sanitizer
## Instructions using a terminal on Linux
Address sanitizer oppdaget en feil i funksjonen fra øving 4: **"heap-buffer-overflow"**.
```sh
git clone https://gitlab.com/ntnu-tdat3020/fuzzing-example
mkdir fuzzing-example/build
cd fuzzing-example/build
CC=clang cmake ..
make
./tests/utility_fuzzer_test -max_total_time=60 # Cancel fuzzing after 60 seconds
```
Denne ble fikset ved å legge til `\0` på slutten av en string, noe jeg hadde glemt.
### Fuzzing
En feil funnet i funksjonen fra øving 4 (spesifikt `char* f(char* s, int n)` i utility.h) gjennom fuzzing var **"memory leak"**.
Denne ble fikset ved å istedenfor å opprette stringen som returneres fra funksjonen på heap allokeres den på stack.
Altså `char ret[n];` framfor `char* ret = malloc(n);`.
## CI
Siste kjøring av CI kan finnes gjennom lenken:
https://gitlab.stud.idi.ntnu.no/askbr/nettverk-oving5-fuzzing/-/pipelines/186364
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment