提交 962d4b28 编写于 作者: B Blue Swirl

fw_cfg: fix crash if FW_CFG_WRITE_CHANNEL is used incorrectly

Avoid a crash if the guest combines FW_CFG_WRITE_CHANNEL with
a wrong value.
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 9f8d2a09
......@@ -214,7 +214,8 @@ static void fw_cfg_write(FWCfgState *s, uint8_t value)
FW_CFG_DPRINTF("write %d\n", value);
if (s->cur_entry & FW_CFG_WRITE_CHANNEL && s->cur_offset < e->len) {
if (s->cur_entry & FW_CFG_WRITE_CHANNEL && e->callback &&
s->cur_offset < e->len) {
e->data[s->cur_offset++] = value;
if (s->cur_offset == e->len) {
e->callback(e->callback_opaque, e->data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册