diff options
| author | Aleksa Vučković <aleksav013@gmail.com> | 2022-02-01 20:59:02 +0100 |
|---|---|---|
| committer | Aleksa Vučković <aleksav013@gmail.com> | 2022-02-01 20:59:12 +0100 |
| commit | fad24f13855643b9410cfcd1045067e842e26f82 (patch) | |
| tree | 11386b804fa7b8ce5c1368dd02a368f590234657 | |
| parent | 147200155c716a4ee76aa1f0402b90012d0a2883 (diff) | |
Keyboard buffer overflow fix
| -rw-r--r-- | src/c/keyboard.c | 7 | ||||
| -rw-r--r-- | src/c/paging.c | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/c/keyboard.c b/src/c/keyboard.c index a95d399..ab31315 100644 --- a/src/c/keyboard.c +++ b/src/c/keyboard.c @@ -150,8 +150,11 @@ void keyboard_handler() { c=shift_charcode[keycode]; } - buffer[buffer_current][buffer_index++]=c; - printf("%c",c); + if(buffer_index<BUFFER_SIZE) + { + buffer[buffer_current][buffer_index++]=c; + printf("%c",c); + } } break; } diff --git a/src/c/paging.c b/src/c/paging.c index 9c4875a..4aba4af 100644 --- a/src/c/paging.c +++ b/src/c/paging.c @@ -33,8 +33,8 @@ void set_pt(size_t num,uint32_t address) { // As the address is page aligned, it will always leave 12 bits zeroed. // Those bits are used by the attributes ;) - page_table[num][i] = (address + i * 0x1000) | 3; // attributes: - supervisor level, read/write, present. + page_table[num][i] = (address + i * 0x1000) | 3; + // attributes: supervisor level, read/write, present. } page_directory[num] = ((uint32_t)page_table[num]) | 3; |
