mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-23 04:04:44 +08:00
tpm: use memmove() for overlapping buffers
The behavior of memcpy() for overlapping buffers is undefined.
Fixes: 4c57ec76b7
("tpm: Implement state command for Cr50")
Addresses-Coverity-ID: 356664 Overlapping buffer in memory copy
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
parent
f39199e809
commit
6c717d952d
@ -821,7 +821,7 @@ u32 tpm2_report_state(struct udevice *dev, uint vendor_cmd, uint vendor_subcmd,
|
||||
if (*recv_size < 12)
|
||||
return -ENODATA;
|
||||
*recv_size -= 12;
|
||||
memcpy(recvbuf, recvbuf + 12, *recv_size);
|
||||
memmove(recvbuf, recvbuf + 12, *recv_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user