hcgpalm/FreeRDP — comment on commit ded92bc9cd7379d054428fb5042df0e3e5bfc111
File:  line 0
By hcgpalm:

Not the same thing... cbPassword is what we send as the password length field in the packet;
stream_write_uint16(s, cbPassword); /* cbPassword */

And, if the password_cookie code was doing the right thing, it should be off by 2 wrt the actual number of bytes we send as the password (passwordLength).

That's the bit that makes me confused, but I have no way to test that use case. Perhaps that case is also wrong and cbPassword should always be the same as the number of password bytes in the packet? I.e. just removing the cbPassword + 2 is the correct fix?