[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.0.5-testing] [qemu-dm] Add bounds checks to block device reads/writes.



# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Date 1177430529 -3600
# Node ID 837d12d4d2d15be322b2fc9a1eb925ddfdcbd3d9
# Parent  9e86260b95a4fad1fa0ae8e3df13453311bf2f34
[qemu-dm] Add bounds checks to block device reads/writes.

Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
 tools/ioemu/block.c |    4 ++++
 1 files changed, 4 insertions(+)

diff -r 9e86260b95a4 -r 837d12d4d2d1 tools/ioemu/block.c
--- a/tools/ioemu/block.c       Tue Apr 24 17:02:07 2007 +0100
+++ b/tools/ioemu/block.c       Tue Apr 24 17:02:09 2007 +0100
@@ -420,6 +420,8 @@ int bdrv_read(BlockDriverState *bs, int6
 
     if (!bs->inserted)
         return -1;
+    if (sector_num < 0)
+       return -1;
 
     while (nb_sectors > 0) {
         if (sector_num == 0 && bs->boot_sector_enabled) {
@@ -458,6 +460,8 @@ int bdrv_write(BlockDriverState *bs, int
         return -1;
     if (bs->read_only)
         return -1;
+    if (sector_num < 0)
+       return -1;
     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
         memcpy(bs->boot_sector_data, buf, 512);   
     }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.