limit-fdc-sector-size-to-16k
来自「xen 3.2.2 源码」· 代码 · 共 33 行
TXT
33 行
# HG changeset patch# User kfraser@localhost.localdomain# Node ID f711b87ba951e608287abd0de028c6f0d83400a9# Parent f3ee62b7fb5299c89d442845e0883bcfab78c067[QEMU] fdc: Limit sector size to 16KIn fdctrl_start_transfer the sector size field (fifo[5]) is notchecked for overflows. This allows an arbitrarily large sector sizeto be used, which can in turn result in a negative data_len field thatis then used for DMA transfers.This can lead to the corrpuption of qemu state because some subsequentchecks on the transfer length is conducted using signed integers.This patch limits the value fifo[5] to 7 which is the standard limiton floppy sector size.Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>Index: ioemu/hw/fdc.c===================================================================--- ioemu.orig/hw/fdc.c 2006-12-08 18:21:36.000000000 +0000+++ ioemu/hw/fdc.c 2006-12-08 18:22:57.000000000 +0000@@ -898,7 +898,7 @@ fdctrl->data_len = fdctrl->fifo[8]; } else { int tmp;- fdctrl->data_len = 128 << fdctrl->fifo[5];+ fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]); tmp = (cur_drv->last_sect - ks + 1); if (fdctrl->fifo[0] & 0x80) tmp += cur_drv->last_sect;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?