fix off-by-one memcpy regression