From: Gerd Hoffmann Date: Tue, 8 Jan 2019 10:23:01 +0000 (+0100) Subject: i2c-ddc: fix oob read X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b05b267840515730dbf6753495d5b7bd8b04ad1c;p=qemu.git i2c-ddc: fix oob read Suggested-by: Michael Hanselmann Signed-off-by: Gerd Hoffmann Reviewed-by: Michael Hanselmann Reviewed-by: Philippe Mathieu-Daudé Message-id: 20190108102301.1957-1-kraxel@redhat.com --- diff --git a/hw/i2c/i2c-ddc.c b/hw/i2c/i2c-ddc.c index be34fe072c..0a0367ff38 100644 --- a/hw/i2c/i2c-ddc.c +++ b/hw/i2c/i2c-ddc.c @@ -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; }