libfreerdp-core: TPKT length is big-endian.

This commit is contained in:
Vic Lee 2011-07-03 18:01:37 +08:00
parent 5036f150e4
commit addc192965
2 changed files with 11 additions and 2 deletions

View File

@ -116,5 +116,14 @@ stream_extend(STREAM * stream);
(((uint64)(*(_s->ptr + 7))) << 56); \
} while (0)
#define stream_read_uint16_be(_s, _v) do { _v = \
(((uint16)(*_s->ptr)) << 8) + \
(uint16)(*(_s->ptr + 1)); \
_s->ptr += 2; } while (0)
#define stream_write_uint16_be(_s, _v) do { \
*_s->ptr++ = ((_v) >> 8) & 0xFF; \
*_s->ptr++ = (_v) & 0xFF; } while (0)
#endif /* __STREAM_UTILS_H */

View File

@ -64,7 +64,7 @@ tpkt_read_header(STREAM* s)
if (version == 3)
{
stream_seek(s, 2);
stream_read_uint16(s, length);
stream_read_uint16_be(s, length);
}
else
{
@ -80,5 +80,5 @@ tpkt_write_header(STREAM* s, int length)
{
stream_write_uint8(s, 3); /* version */
stream_write_uint8(s, 8); /* reserved */
stream_write_uint16(s, length); /* length */
stream_write_uint16_be(s, length); /* length */
}