pcnet: fix Negative array index read
commit7b50d00911ddd6d56a766ac5671e47304c20a21b
authorGonglei <arei.gonglei@huawei.com>
Thu, 20 Nov 2014 11:35:02 +0000 (20 19:35 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 21 Nov 2014 10:50:54 +0000 (21 10:50 +0000)
treeb2ac5239d4f3f80cfd5609b5c8dbb33063e11957
parent8db804ac412010fc96397c2d67ee6417eccd9d34
pcnet: fix Negative array index read

s->xmit_pos maybe assigned to a negative value (-1),
but in this branch variable s->xmit_pos as an index to
array s->buffer. Let's add a check for s->xmit_pos.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/net/pcnet.c