]> git.ipfire.org Git - thirdparty/qemu.git/commit
ipmi:smbus: Add a check around a memcpy
authorCorey Minyard <cminyard@mvista.com>
Sun, 31 Jul 2022 22:58:09 +0000 (17:58 -0500)
committerCorey Minyard <cminyard@mvista.com>
Mon, 1 Aug 2022 11:40:50 +0000 (06:40 -0500)
commit3fde641e7286f9b968bdb3b4b922c6465f2a9abc
tree93976fc3c0c606515221aae4f182e635aa29bc2f
parentcc42559ab129a15554cc485ea9265e34dde7ab5b
ipmi:smbus: Add a check around a memcpy

In one case:

  memcpy(sid->inmsg + sid->inlen, buf, len);

if len == 0 then sid->inmsg + sig->inlen can point to one past the inmsg
array if the array is full.  We have to allow len == 0 due to some
vagueness in the spec, but we don't have to call memcpy.

Found by Coverity.  This is not a problem in practice, but the results
are technically (maybe) undefined.  So make Coverity happy.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
hw/ipmi/smbus_ipmi.c