erts: Make sure memcpy does not read out of bounds for VALGRIND target