diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 807b5d3de321..6a7a10501bd6 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -1826,6 +1826,13 @@ int sd_do_command(SDState *sd, SDRequest *req, break; case sd_r0: + /* + * Invalid state transition, reset implementation + * fields to avoid OOB abuse. + */ + sd->data_start = 0; + sd->data_offset = 0; + /* fall-through */ case sd_illegal: rsplen = 0; break;