diff options
author | Anton Kling <anton@kling.gg> | 2024-05-02 22:30:02 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-05-02 22:30:02 +0200 |
commit | 98c1cf73ffec377a612930f08ced0e527414bc03 (patch) | |
tree | eda6ccce99fe4247f68c0fe06320178246b6536d /kernel/arch/i386/mmu.c | |
parent | 3964ecb4f68654baa9728161446a765734845894 (diff) |
Bug: Kernel: Bounds check array access
Diffstat (limited to 'kernel/arch/i386/mmu.c')
-rw-r--r-- | kernel/arch/i386/mmu.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/arch/i386/mmu.c b/kernel/arch/i386/mmu.c index bdb4bd6..8d1f9af 100644 --- a/kernel/arch/i386/mmu.c +++ b/kernel/arch/i386/mmu.c @@ -157,6 +157,9 @@ int get_free_frame(u32 *frame) { int write_to_frame(u32 frame_address, u8 on) { u32 frame = frame_address / 0x1000; + if (INDEX_FROM_BIT(frame) >= num_array_frames) { + return 0; + } if (on) { int frame_is_used = (0 != (tmp_small_frames[INDEX_FROM_BIT(frame)] & ((u32)0x1 << OFFSET_FROM_BIT(frame)))); |