From b7270479a5bd14512ec33112b6da14e8caab33ed Mon Sep 17 00:00:00 2001 From: pfaure Date: Thu, 24 Jun 2021 09:45:50 +0200 Subject: [PATCH] =?UTF-8?q?Fin=20impl=C3=A9mentation=20programme=20vulnera?= =?UTF-8?q?ble?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InterpreteurRegistres | 2 +- prog_vulnerable.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/InterpreteurRegistres b/InterpreteurRegistres index bff261f..cf119a9 160000 --- a/InterpreteurRegistres +++ b/InterpreteurRegistres @@ -1 +1 @@ -Subproject commit bff261fa01129da9135f95f16bf4124366ea24fe +Subproject commit cf119a9a257d0885c86920f0cd6945cbbf4134fa diff --git a/prog_vulnerable.c b/prog_vulnerable.c index 41e4555..67f2a9d 100644 --- a/prog_vulnerable.c +++ b/prog_vulnerable.c @@ -1,5 +1,6 @@ int lire_tableau() { int tab[5] = {0,0,0,0,0}; + printf(255); stop(20); printf(0); @@ -9,24 +10,20 @@ int lire_tableau() { printf(0); stop(200); int val = get(); - int i = 0; - while (i<7) { - tab[5-i] = i; - i = i + 1; - } - int i = 0; - while (i<5) { - printf(tab[i]); + + int i = 1; + while (i<8) { + tab[5-i] = val; i = i + 1; } } int youVeBeenHacked() { while (1) { - printf(0); - stop(20); printf(255); - stop(20); + stop(10); + printf(0); + stop(10); } } @@ -42,6 +39,9 @@ int legitimeFunction() { } int main() { + int a = 0; + int b = 0; lire_tableau(); legitimeFunction(); + printf(a); }