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 <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
if (*recv_size < 12)
return -ENODATA;
*recv_size -= 12;
- memcpy(recvbuf, recvbuf + 12, *recv_size);
+ memmove(recvbuf, recvbuf + 12, *recv_size);
return 0;
}