mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
In the case of non-sequential mappings, ofw_mapmem() could ask Open
Firmware to map a memory region with negative length, causing crashes and Undefined Behavior. Add the appropriate check to make the behavior defined.
This commit is contained in:
parent
287cf3e528
commit
fa942e6074
1 changed files with 1 additions and 1 deletions
|
|
@ -68,7 +68,7 @@ ofw_mapmem(vm_offset_t dest, const size_t len)
|
|||
/*
|
||||
* Trim area covered by existing mapping, if any
|
||||
*/
|
||||
if (dest < (last_dest + last_len)) {
|
||||
if (dest < (last_dest + last_len) && dest >= last_dest) {
|
||||
nlen -= (last_dest + last_len) - dest;
|
||||
dest = last_dest + last_len;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue