Revert "Remove special handling for length field."

This reverts commit cda4eded9861bea93e2467bdd65fc7ba8b41dfc9.

Change-Id: Ie83ae3a1afb0bf8ca73b3a3597b149ab264274b4