Index: ioemu/block.c
===================================================================
--- ioemu.orig/block.c	2007-05-09 13:31:35.000000000 +0100
+++ ioemu/block.c	2007-05-09 13:32:33.000000000 +0100
@@ -502,6 +502,9 @@
     if (!drv)
         return -ENOMEDIUM;
 
+    if (sector_num < 0)
+	return -EINVAL;
+
     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
             memcpy(buf, bs->boot_sector_data, 512);
         sector_num++;
@@ -539,6 +542,8 @@
         return -ENOMEDIUM;
     if (bs->read_only)
         return -EACCES;
+    if (sector_num < 0)
+	return -EINVAL;
     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
         memcpy(bs->boot_sector_data, buf, 512);   
     }
