diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-04-08 13:38:35 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-04-08 13:38:35 +0200 |
| commit | 2ac97283d813414973f83d177280aafa7fbaa66f (patch) | |
| tree | dfb189f320d8202bcaaea58c13e7d9e818f267ac /dev/kernel/src/BitMapMgr.cc | |
| parent | daff01e877ba628370e506a56b4065aeb5814138 (diff) | |
kernel, storage, heap, abi: lots of improvements and tweaks.
- Please read the commit details for in-depth insights.
- Add stack smash prevention code.
- Better prevention in BitMap Mgr.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/src/BitMapMgr.cc')
| -rw-r--r-- | dev/kernel/src/BitMapMgr.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/dev/kernel/src/BitMapMgr.cc b/dev/kernel/src/BitMapMgr.cc index 7f3f8500..51c4aed1 100644 --- a/dev/kernel/src/BitMapMgr.cc +++ b/dev/kernel/src/BitMapMgr.cc @@ -141,7 +141,15 @@ namespace Kernel return (VoidPtr)ptr_bit_set; } - base = reinterpret_cast<VoidPtr>(reinterpret_cast<UIntPtr>(base) + ((ptr_bit_set[kBitMapMagIdx] != kBitMapMagic) ? (size + pad) : ptr_bit_set[kBitMapSizeIdx])); + UIntPtr raw_base = reinterpret_cast<UIntPtr>(base); + UIntPtr offset = (ptr_bit_set[kBitMapMagIdx] != kBitMapMagic) + ? (size + pad) + : ptr_bit_set[kBitMapSizeIdx]; + + base = reinterpret_cast<VoidPtr>(raw_base + offset); + + if (base == nullptr) + return nullptr; } return nullptr; |
