diff options
| author | Heinrich Schuchardt <[email protected]> | 2024-11-02 11:27:37 +0100 |
|---|---|---|
| committer | Ilias Apalodimas <[email protected]> | 2024-11-16 19:21:59 +0200 |
| commit | 6c717d952d455d2efc267496fa9797a656459e6f (patch) | |
| tree | 6f5eccf11580102599e5107a715a3bf9717359f7 /lib | |
| parent | f39199e8096dab68fe4a8e15f8ff60026a5fe491 (diff) | |
tpm: use memmove() for overlapping buffers
The behavior of memcpy() for overlapping buffers is undefined.
Fixes: 4c57ec76b725 ("tpm: Implement state command for Cr50")
Addresses-Coverity-ID: 356664 Overlapping buffer in memory copy
Signed-off-by: Heinrich Schuchardt <[email protected]>
Reviewed-by: Ilias Apalodimas <[email protected]>
Signed-off-by: Ilias Apalodimas <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tpm-v2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c index 59e6cbafafa..ad2b5ab0c32 100644 --- a/lib/tpm-v2.c +++ b/lib/tpm-v2.c @@ -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; } |
