Update putint and getint
And rapport for TD1
This commit is contained in:
parent
e2df8860bd
commit
26f9a4226f
4 changed files with 84 additions and 41 deletions
|
@ -5,6 +5,5 @@ int main(){
|
|||
int number;
|
||||
GetInt(&number);
|
||||
PutInt(number);
|
||||
PutChar('\n');
|
||||
} while(1 == 1);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
#include "syscall.h"
|
||||
#define MAX_INPUT_SIZE 4
|
||||
#define MAX_INPUT_SIZE 16
|
||||
|
||||
int main(){
|
||||
char t[100];
|
||||
// this test write write on the output what the user entered in the input
|
||||
// If we remove the loop, all caracters after MAX_INPUT_SIZE will be writed
|
||||
// on my linux shell... A quite big security flaw, imagine
|
||||
// 1234567812345678sudo rm -rf /\n ;)
|
||||
do {
|
||||
//in our loop, char before the MAX_INPUT_SIZE sill be passed to the
|
||||
// next getstring...
|
||||
GetString(t, MAX_INPUT_SIZE);
|
||||
PutString(t);
|
||||
PutChar('\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue