Some fixes for potentials NULL pointer dereferences, and double-free of buffers

This commit is contained in:
Julien Ropé 2012-05-04 15:50:33 +02:00
parent 7aa29e9e0b
commit c1f7044693
6 changed files with 15 additions and 11 deletions

View File

@ -125,9 +125,8 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob)
#endif
xfree(cups_printjob);
((rdpCupsPrinter*)printjob->printer)->printjob = NULL;
xfree(cups_printjob) ;
}
static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)

View File

@ -1180,7 +1180,7 @@ int xfreerdp_run(freerdp* instance)
/** Entry point for the thread that will deal with the session.
* It just calls xfreerdp_run() using the given instance as parameter.
* @param - pointer to a thread_data structure that contains the initialized connection.
* @param param - pointer to a thread_data structure that contains the initialized connection.
*/
void* thread_func(void* param)
{

View File

@ -287,6 +287,12 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF
PCHANNEL_DEF lchannel_def;
struct channel_data* lchannel_data;
if (ppInitHandle == NULL)
{
DEBUG_CHANNELS("error bad pphan");
return CHANNEL_RC_BAD_INIT_HANDLE;
}
channels = g_init_channels;
channels->init_handles[channels->num_init_handles].channels = channels;
*ppInitHandle = &channels->init_handles[channels->num_init_handles];
@ -300,12 +306,6 @@ static uint32 FREERDP_CC MyVirtualChannelInit(void** ppInitHandle, PCHANNEL_DEF
return CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY;
}
if (ppInitHandle == 0)
{
DEBUG_CHANNELS("error bad pphan");
return CHANNEL_RC_BAD_INIT_HANDLE;
}
if (channels->num_channels_data + channelCount >= CHANNEL_MAX_COUNT)
{
DEBUG_CHANNELS("error too many channels");

View File

@ -310,11 +310,13 @@ boolean WTSVirtualChannelWrite(
wts_data_item* item;
boolean result = false;
rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;
WTSVirtualChannelManager* vcm = channel->vcm;
WTSVirtualChannelManager* vcm ;
if (channel == NULL)
return false;
vcm = channel->vcm ;
if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC)
{
item = xnew(wts_data_item);

View File

@ -357,7 +357,10 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
if (certificate_status && hostname_match)
{
if (common_name)
{
xfree(common_name);
common_name=NULL ;
}
verification_status = true; /* success! */
}

View File

@ -261,7 +261,7 @@ int krb_decode_cname(STREAM* s, uint8 tag, char** str)
if(verlen != len)
{
xfree(str);
xfree(*str);
*str = NULL;
goto err;
}