Fix the error case in mcs_send_connect_response()

This commit is contained in:
David FORT 2015-04-01 17:55:01 +02:00
parent 23e11e5a3d
commit a4a58aa373
2 changed files with 10 additions and 4 deletions

View File

@ -570,12 +570,14 @@ void mcs_write_connect_initial(wStream* s, rdpMcs* mcs, wStream* userData)
* @param user_data GCC Conference Create Response * @param user_data GCC Conference Create Response
*/ */
void mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userData) BOOL mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userData)
{ {
int length; int length;
wStream* tmps; wStream* tmps;
tmps = Stream_New(NULL, Stream_Capacity(s)); tmps = Stream_New(NULL, Stream_Capacity(s));
if (!tmps)
return FALSE;
ber_write_enumerated(tmps, 0, MCS_Result_enum_length); ber_write_enumerated(tmps, 0, MCS_Result_enum_length);
ber_write_integer(tmps, 0); /* calledConnectId */ ber_write_integer(tmps, 0); /* calledConnectId */
mcs_write_domain_parameters(tmps, &(mcs->domainParameters)); mcs_write_domain_parameters(tmps, &(mcs->domainParameters));
@ -586,6 +588,7 @@ void mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userData)
ber_write_application_tag(s, MCS_TYPE_CONNECT_RESPONSE, length); ber_write_application_tag(s, MCS_TYPE_CONNECT_RESPONSE, length);
Stream_Write(s, Stream_Buffer(tmps), length); Stream_Write(s, Stream_Buffer(tmps), length);
Stream_Free(tmps, TRUE); Stream_Free(tmps, TRUE);
return TRUE;
} }
/** /**
@ -705,7 +708,8 @@ BOOL mcs_send_connect_response(rdpMcs* mcs)
bm = Stream_GetPosition(s); bm = Stream_GetPosition(s);
Stream_Seek(s, 7); Stream_Seek(s, 7);
mcs_write_connect_response(s, mcs, gcc_CCrsp); if (!mcs_write_connect_response(s, mcs, gcc_CCrsp))
goto error_write_connect_response;
em = Stream_GetPosition(s); em = Stream_GetPosition(s);
length = (em - bm); length = (em - bm);
Stream_SetPosition(s, bm); Stream_SetPosition(s, bm);
@ -723,10 +727,12 @@ BOOL mcs_send_connect_response(rdpMcs* mcs)
return (status < 0) ? FALSE : TRUE; return (status < 0) ? FALSE : TRUE;
error_write_connect_response:
Stream_Free(s, TRUE);
error_stream_s: error_stream_s:
Stream_Free(gcc_CCrsp, TRUE); Stream_Free(gcc_CCrsp, TRUE);
error_data_blocks: error_data_blocks:
Stream_Free(s, TRUE); Stream_Free(server_data, TRUE);
return FALSE; return FALSE;
} }

View File

@ -165,7 +165,7 @@ BOOL mcs_merge_domain_parameters(DomainParameters* targetParameters, DomainParam
DomainParameters* maximumParameters, DomainParameters* pOutParameters); DomainParameters* maximumParameters, DomainParameters* pOutParameters);
void mcs_write_connect_initial(wStream* s, rdpMcs* mcs, wStream* userData); void mcs_write_connect_initial(wStream* s, rdpMcs* mcs, wStream* userData);
void mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userData); BOOL mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userData);
BOOL mcs_recv_connect_initial(rdpMcs* mcs, wStream* s); BOOL mcs_recv_connect_initial(rdpMcs* mcs, wStream* s);
BOOL mcs_send_connect_initial(rdpMcs* mcs); BOOL mcs_send_connect_initial(rdpMcs* mcs);