diff options
author | Marvin Borner | 2020-02-01 18:30:35 +0100 |
---|---|---|
committer | Marvin Borner | 2020-02-01 18:30:35 +0100 |
commit | 6135c0e7d56e3b0faf7e942ccbdc1a59f41d7ba6 (patch) | |
tree | 6879dd8748c412aa183c3aecffaf16f7c04c53ac | |
parent | 85aea3c82746bbcfe8562e0ff90c77292651fa13 (diff) |
Fixed critical memory bug
Overflow via >32 int
-rw-r--r-- | src/kernel/interrupts/isr.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/kernel/interrupts/isr.c b/src/kernel/interrupts/isr.c index d89f581..42dbaa6 100644 --- a/src/kernel/interrupts/isr.c +++ b/src/kernel/interrupts/isr.c @@ -64,7 +64,7 @@ void isr_uninstall_handler(size_t isr) } // Error exception messages -const char *exception_messages[] = { +const char *exception_messages[32] = { "Division By Zero", "Debug", "Non Maskable Interrupt", @@ -117,14 +117,18 @@ void fault_handler(struct regs *r) r->eip, r->eax, r->ebx, r->ecx, r->edx, r->esp, faulting_address, r->eflags, r->err_code, r->int_no, exception_messages[r->int_no] ); - // halt_loop(); // Idk loop? - char *message = (char *) exception_messages[r->int_no]; - strcat(message, " Exception"); - - // Show message if there wasn't an error in video memory - if (faulting_address != (uint32_t) fb) - panic(message); - else - halt_loop(); + + if (r->int_no <= 32) { + char *message = (char *) exception_messages[r->int_no]; + strcat(message, " Exception"); + + // Show message if there wasn't an error in video memory + if (faulting_address != (uint32_t) fb) + panic(message); + else + halt_loop(); + } else { + panic("Unknown Exception"); + } } }
\ No newline at end of file |