aboutsummaryrefslogtreecommitdiff
path: root/hw/i2c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-01-08 11:23:01 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-01-11 11:45:00 +0100
commitb05b267840515730dbf6753495d5b7bd8b04ad1c (patch)
treeb42ece3dcef882c4bf17646d22bc69c7e17cfed6 /hw/i2c
parentc2077ec2d98f3914b850212f00ca5456b6e4774d (diff)
i2c-ddc: fix oob read
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
Diffstat (limited to 'hw/i2c')
-rw-r--r--hw/i2c/i2c-ddc.c2
1 files changed, 1 insertions, 1 deletions
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;
}