[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]
Bug in licence_send_request
Hello Folks.
I am currently porting rdesktop to java and I have found something
which might be a bug. In the function licence_send_request in
licence.c:
uint16 userlen = strlen(user) + 1;
uint16 hostlen = strlen(host) + 1;
uint16 length = 120 + userlen + hostlen;
/* If the username is testtest userlen = 9 and if hostname is foofoo1
hostlen = 8 */
s = sec_init(sec_flags, length + 2);
/* Initialize a stream with length 120 + 8 + 9 + 2 */
/* why the +2 ? */
out_uint16_le(s, LICENCE_TAG_REQUEST); // 2 bytes
out_uint16_le(s, length); //2
out_uint32_le(s, 1); // 4
out_uint32_le(s, 0xff010000); //4
out_uint8p(s, client_random, SEC_RANDOM_SIZE); //32
out_uint16(s, 0); //2
out_uint16_le(s, (SEC_MODULUS_SIZE + SEC_PADDING_SIZE)); //2
out_uint8p(s, rsa_data, SEC_MODULUS_SIZE); // 64
out_uint8s(s, SEC_PADDING_SIZE); // 8
/* Until here we have got 120 bytes of data */
out_uint16(s, LICENCE_TAG_USER); // 2
out_uint16(s, userlen); // 2
out_uint8p(s, user, userlen); // 9
out_uint16(s, LICENCE_TAG_HOST); // 2
out_uint16(s, hostlen); // 2
out_uint8p(s, host, hostlen); // 8
s_mark_end(s);
/* here we have another 25 bytes of data
so total length of data is 145 bytes but length is only 137
bytes. If this has a purpose then would let me anzbody know why?
The terminal server seems to ignore the wrong length but maybe you
would still like to fix it in a future release? */
Regards
Christian