]> git.proxmox.com Git - mirror_qemu.git/commitdiff
i2c-ddc: fix oob read
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 8 Jan 2019 10:23:01 +0000 (11:23 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 11 Jan 2019 10:45:00 +0000 (11:45 +0100)
Suggested-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190108102301.1957-1-kraxel@redhat.com

hw/i2c/i2c-ddc.c

index be34fe072cf1f7db9ca36c307f099d08455963f6..0a0367ff38f993bc379f8a1abc35295ec9b9f691 100644 (file)
@@ -56,7 +56,7 @@ static int i2c_ddc_rx(I2CSlave *i2c)
     I2CDDCState *s = I2CDDC(i2c);
 
     int value;
-    value = s->edid_blob[s->reg];
+    value = s->edid_blob[s->reg % sizeof(s->edid_blob)];
     s->reg++;
     return value;
 }