Add check to avoid using memcpy with an invalid data pointer

This commit is contained in:
A.J. Beamon 2022-06-22 15:57:47 -07:00
parent 75423a100c
commit 485df52b0f
1 changed files with 3 additions and 1 deletions

View File

@ -625,7 +625,9 @@ public:
// Copies string contents to dst and returns a pointer to the next byte after
uint8_t* copyTo(uint8_t* dst) const {
memcpy(dst, data, length);
if (length > 0) {
memcpy(dst, data, length);
}
return dst + length;
}