mirror of https://github.com/FreeRDP/FreeRDP
check or propagate return values when writing
This commit is contained in:
parent
ad8723010d
commit
0abf945a18
|
@ -145,9 +145,7 @@ BOOL rdp_send_server_control_cooperate_pdu(rdpRdp* rdp)
|
|||
stream_write_UINT16(s, 0); /* grantId (2 bytes) */
|
||||
stream_write_UINT32(s, 0); /* controlId (4 bytes) */
|
||||
|
||||
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id);
|
||||
|
||||
return TRUE;
|
||||
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id);
|
||||
}
|
||||
|
||||
BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp)
|
||||
|
@ -160,9 +158,7 @@ BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp)
|
|||
stream_write_UINT16(s, rdp->mcs->user_id); /* grantId (2 bytes) */
|
||||
stream_write_UINT32(s, 0x03EA); /* controlId (4 bytes) */
|
||||
|
||||
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id);
|
||||
|
||||
return TRUE;
|
||||
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id);
|
||||
}
|
||||
|
||||
BOOL rdp_send_client_control_pdu(rdpRdp* rdp, UINT16 action)
|
||||
|
@ -288,9 +284,17 @@ BOOL rdp_recv_deactivate_all(rdpRdp* rdp, STREAM* s)
|
|||
*/
|
||||
if (stream_get_left(s) > 0)
|
||||
{
|
||||
stream_read_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
|
||||
stream_read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */
|
||||
stream_seek(s, lengthSourceDescriptor); /* sourceDescriptor (should be 0x00) */
|
||||
do {
|
||||
if(stream_get_left(s) < 4)
|
||||
break;
|
||||
stream_read_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
|
||||
if(stream_get_left(s) < 2)
|
||||
break;
|
||||
stream_read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */
|
||||
if(stream_get_left(s) < lengthSourceDescriptor)
|
||||
break;
|
||||
stream_seek(s, lengthSourceDescriptor); /* sourceDescriptor (should be 0x00) */
|
||||
} while(0);
|
||||
}
|
||||
|
||||
rdp->state = CONNECTION_STATE_CAPABILITY;
|
||||
|
|
|
@ -2147,9 +2147,7 @@ BOOL rdp_send_demand_active(rdpRdp* rdp)
|
|||
|
||||
rdp_write_demand_active(s, rdp->settings);
|
||||
|
||||
rdp_send_pdu(rdp, s, PDU_TYPE_DEMAND_ACTIVE, rdp->mcs->user_id);
|
||||
|
||||
return TRUE;
|
||||
return rdp_send_pdu(rdp, s, PDU_TYPE_DEMAND_ACTIVE, rdp->mcs->user_id);
|
||||
}
|
||||
|
||||
BOOL rdp_recv_confirm_active(rdpRdp* rdp, STREAM* s)
|
||||
|
|
|
@ -337,7 +337,8 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, STREAM* s)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
rdp_read_security_header(s, &sec_flags);
|
||||
if (!rdp_read_security_header(s, &sec_flags))
|
||||
return FALSE;
|
||||
|
||||
if ((sec_flags & SEC_EXCHANGE_PKT) == 0)
|
||||
{
|
||||
|
@ -345,7 +346,12 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, STREAM* s)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if(stream_get_left(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, rand_len);
|
||||
if(stream_get_left(s) < rand_len + 8) /* include 8 bytes of padding */
|
||||
return FALSE;
|
||||
|
||||
key_len = rdp->settings->RdpServerRsaKey->ModulusLength;
|
||||
|
||||
if (rand_len != key_len + 8)
|
||||
|
@ -547,9 +553,7 @@ BOOL rdp_client_connect_demand_active(rdpRdp* rdp, STREAM* s)
|
|||
rdp->state = CONNECTION_STATE_FINALIZATION;
|
||||
update_reset_state(rdp->update);
|
||||
|
||||
rdp_client_connect_finalize(rdp);
|
||||
|
||||
return TRUE;
|
||||
return rdp_client_connect_finalize(rdp);
|
||||
}
|
||||
|
||||
BOOL rdp_client_connect_finalize(rdpRdp* rdp)
|
||||
|
|
|
@ -439,7 +439,9 @@ BOOL rdp_recv_client_info(rdpRdp* rdp, STREAM* s)
|
|||
if (!rdp_read_header(rdp, s, &length, &channelId))
|
||||
return FALSE;
|
||||
|
||||
rdp_read_security_header(s, &securityFlags);
|
||||
if (!rdp_read_security_header(s, &securityFlags))
|
||||
return FALSE;
|
||||
|
||||
if ((securityFlags & SEC_INFO_PKT) == 0)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -932,9 +932,7 @@ BOOL license_send_valid_client_error_packet(rdpLicense* license)
|
|||
|
||||
license_write_binary_blob(s, license->error_info);
|
||||
|
||||
license_send(license, s, ERROR_ALERT);
|
||||
|
||||
return TRUE;
|
||||
return license_send(license, s, ERROR_ALERT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -532,6 +532,7 @@ BOOL mcs_send_connect_response(rdpMcs* mcs)
|
|||
{
|
||||
STREAM* s;
|
||||
int length;
|
||||
int ret;
|
||||
BYTE *bm, *em;
|
||||
STREAM* gcc_CCrsp;
|
||||
STREAM* server_data;
|
||||
|
@ -556,12 +557,12 @@ BOOL mcs_send_connect_response(rdpMcs* mcs)
|
|||
tpdu_write_data(s);
|
||||
stream_set_mark(s, em);
|
||||
|
||||
transport_write(mcs->transport, s);
|
||||
ret = transport_write(mcs->transport, s);
|
||||
|
||||
stream_free(gcc_CCrsp);
|
||||
stream_free(server_data);
|
||||
|
||||
return TRUE;
|
||||
return (ret < 0) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -135,6 +135,8 @@ static BOOL peer_recv_data_pdu(freerdp_peer* client, STREAM* s)
|
|||
return FALSE;
|
||||
|
||||
case DATA_PDU_TYPE_FRAME_ACKNOWLEDGE:
|
||||
if(stream_get_left(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, client->ack_frame_id);
|
||||
break;
|
||||
|
||||
|
@ -176,7 +178,8 @@ static int peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s)
|
|||
|
||||
if (rdp->settings->DisableEncryption)
|
||||
{
|
||||
rdp_read_security_header(s, &securityFlags);
|
||||
if (!rdp_read_security_header(s, &securityFlags))
|
||||
return -1;
|
||||
|
||||
if (securityFlags & SEC_ENCRYPT)
|
||||
{
|
||||
|
@ -237,7 +240,7 @@ static int peer_recv_fastpath_pdu(freerdp_peer* client, STREAM* s)
|
|||
|
||||
if (fastpath->encryptionFlags & FASTPATH_OUTPUT_ENCRYPTED)
|
||||
{
|
||||
if(!rdp_decrypt(rdp, s, length, (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0))
|
||||
if (!rdp_decrypt(rdp, s, length, (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0))
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue