Fix index guard when copying decrypted data.

This buffer copy method is really verbose and error prone.  Is there a
better way?