kernel - Fix buffer overflow in legacy (non EFI) boot loader
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 30 Oct 2020 18:25:23 +0000 (11:25 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 30 Oct 2020 18:25:23 +0000 (11:25 -0700)
commit56254923026387d8dba5d269d426e6b6b3ad282d
treeee6f3023d6efd8d631512a15897d544bcb8ccef1
parent801a180cccce986aa268e163c5b3a9d21b10899f
kernel - Fix buffer overflow in legacy (non EFI) boot loader

* Fix a buffer overflow primarily in bd_read().  The code contains
  a work-around for segment boundary crossings that very old BIOSes
  would sometimes blow-up on, but was improperly calculating the
  bounce-buffer I/O limit to be the full bounce-buffer size
  instead of 1/2 the bounce buffer size.

  Thus if the bounce buffer's base address happened to be certain
  values, large I/O requests would overflow the buffer.

* Make sure the bounce-buffer is 16-byte aligned, again for old
  BIOSes.

Reported-by: zrj
Debugging-by: dillon, zrj, Naabed-
sys/boot/pc32/libi386/biosdisk.c