memcpy or memmove with a variable length from input can overflow the destination buffer.
Validate the length against the destination capacity before copying.