security: add a NULL pointer check to fix a server crash

based on 7d58aac24f
This commit is contained in:
Bernhard Miklautz 2013-07-11 11:19:35 +02:00
parent 666c732085
commit 4799e1742c
2 changed files with 5 additions and 1 deletions

View File

@ -642,7 +642,8 @@ boolean rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, uint16 securityFlags)
stream_read(s, wmac, sizeof(wmac));
length -= sizeof(wmac);
security_decrypt(s->p, length, rdp);
if (!security_decrypt(s->p, length, rdp))
return false;
if (securityFlags & SEC_SECURE_CHECKSUM)
security_salted_mac_signature(rdp, s->p, length, false, cmac);
else

View File

@ -475,6 +475,9 @@ boolean security_encrypt(uint8* data, int length, rdpRdp* rdp)
boolean security_decrypt(uint8* data, int length, rdpRdp* rdp)
{
if (rdp->decrypt_key == NULL)
return false;
if (rdp->decrypt_use_count >= 4096)
{
security_key_update(rdp->decrypt_key, rdp->decrypt_update_key, rdp->rc4_key_len);