File ioemu-dvd-structure-overflow.patch of Package xen

Index: xen-3.3.1-testing/tools/ioemu-remote/hw/ide.c
===================================================================
--- xen-3.3.1-testing.orig/tools/ioemu-remote/hw/ide.c
+++ xen-3.3.1-testing/tools/ioemu-remote/hw/ide.c
@@ -1942,8 +1942,19 @@ static void ide_atapi_cmd(IDEState *s)
             int media = packet[1];
             int layer = packet[6];
             int format = packet[2];
+            int max_len = ube16_to_cpu(packet + 8);
             uint64_t total_sectors;
 
+            /*
+             *   Avoid for overflow buffer in win2008 VDS.exe
+             *   But IDE_DMA_BUF_SECTORS is too big, not use.
+             *   At least on one SECTOR, less than 2k
+             */
+            if (max_len < 512 + 4)
+                max_len = 512 + 4;
+            if (max_len > 2048 + 4)
+                max_len = 2048 + 4;
+
             if (media != 0 || layer != 0)
             {
                 ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST,
@@ -1973,7 +1984,7 @@ static void ide_atapi_cmd(IDEState *s)
 
                     cpu_to_be16wu((uint16_t *)buf, 2048 + 4);
 
-                    ide_atapi_cmd_reply(s, 2048 + 3, 2048 + 4);
+                    ide_atapi_cmd_reply(s, 2048 + 4, max_len);
                     break;
 
                 default:
openSUSE Build Service is sponsored by