Fixed various scanbuild warnings.
This commit is contained in:
parent
e3e65734e8
commit
6a21bdae3d
52
channels/geometry/client/geometry_main.c
Executable file → Normal file
52
channels/geometry/client/geometry_main.c
Executable file → Normal file
@ -67,12 +67,12 @@ struct _GEOMETRY_PLUGIN
|
||||
IWTSListener* listener;
|
||||
GEOMETRY_LISTENER_CALLBACK* listener_callback;
|
||||
|
||||
GeometryClientContext *context;
|
||||
GeometryClientContext* context;
|
||||
};
|
||||
typedef struct _GEOMETRY_PLUGIN GEOMETRY_PLUGIN;
|
||||
|
||||
|
||||
static UINT32 geometry_read_RGNDATA(wStream *s, UINT32 len, FREERDP_RGNDATA *rgndata)
|
||||
static UINT32 geometry_read_RGNDATA(wStream* s, UINT32 len, FREERDP_RGNDATA* rgndata)
|
||||
{
|
||||
UINT32 dwSize, iType;
|
||||
INT32 right, bottom;
|
||||
@ -84,13 +84,17 @@ static UINT32 geometry_read_RGNDATA(wStream *s, UINT32 len, FREERDP_RGNDATA *rgn
|
||||
}
|
||||
|
||||
Stream_Read_UINT32(s, dwSize);
|
||||
if (dwSize != 32) {
|
||||
|
||||
if (dwSize != 32)
|
||||
{
|
||||
WLog_ERR(TAG, "invalid RGNDATA dwSize");
|
||||
return ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
Stream_Read_UINT32(s, iType);
|
||||
if (iType != RDH_RECTANGLE) {
|
||||
|
||||
if (iType != RDH_RECTANGLE)
|
||||
{
|
||||
WLog_ERR(TAG, "iType %"PRIu32" for RGNDATA is not supported", iType);
|
||||
return ERROR_UNSUPPORTED_TYPE;
|
||||
}
|
||||
@ -101,11 +105,10 @@ static UINT32 geometry_read_RGNDATA(wStream *s, UINT32 len, FREERDP_RGNDATA *rgn
|
||||
Stream_Read_INT32(s, rgndata->boundingRect.y);
|
||||
Stream_Read_INT32(s, right);
|
||||
Stream_Read_INT32(s, bottom);
|
||||
|
||||
rgndata->boundingRect.width = right - rgndata->boundingRect.x;
|
||||
rgndata->boundingRect.height = bottom - rgndata->boundingRect.y;
|
||||
|
||||
len -= 32;
|
||||
|
||||
if (len / (4 * 4) < rgndata->nRectCount)
|
||||
{
|
||||
WLog_ERR(TAG, "not enough data for region rectangles");
|
||||
@ -127,7 +130,6 @@ static UINT32 geometry_read_RGNDATA(wStream *s, UINT32 len, FREERDP_RGNDATA *rgn
|
||||
Stream_Read_INT32(s, rgndata->rects[i].y);
|
||||
Stream_Read_INT32(s, right);
|
||||
Stream_Read_INT32(s, bottom);
|
||||
|
||||
rgndata->rects[i].width = right - rgndata->rects[i].x;
|
||||
rgndata->rects[i].height = bottom - rgndata->rects[i].y;
|
||||
}
|
||||
@ -146,11 +148,10 @@ static UINT geometry_recv_pdu(GEOMETRY_CHANNEL_CALLBACK* callback, wStream* s)
|
||||
UINT32 length, cbGeometryBuffer;
|
||||
MAPPED_GEOMETRY_PACKET packet;
|
||||
GEOMETRY_PLUGIN* geometry;
|
||||
GeometryClientContext *context;
|
||||
GeometryClientContext* context;
|
||||
UINT ret;
|
||||
|
||||
geometry = (GEOMETRY_PLUGIN*) callback->plugin;
|
||||
context = (GeometryClientContext *)geometry->iface.pInterface;
|
||||
context = (GeometryClientContext*)geometry->iface.pInterface;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
{
|
||||
@ -159,7 +160,8 @@ static UINT geometry_recv_pdu(GEOMETRY_CHANNEL_CALLBACK* callback, wStream* s)
|
||||
}
|
||||
|
||||
Stream_Read_UINT32(s, length); /* Length (4 bytes) */
|
||||
if (length < 73 || Stream_GetRemainingLength(s) < (length-4))
|
||||
|
||||
if (length < 73 || Stream_GetRemainingLength(s) < (length - 4))
|
||||
{
|
||||
WLog_ERR(TAG, "invalid packet length");
|
||||
return ERROR_INVALID_DATA;
|
||||
@ -170,20 +172,17 @@ static UINT geometry_recv_pdu(GEOMETRY_CHANNEL_CALLBACK* callback, wStream* s)
|
||||
Stream_Read_UINT32(s, packet.updateType);
|
||||
Stream_Seek_UINT32(s); /* flags */
|
||||
Stream_Read_UINT64(s, packet.topLevelId);
|
||||
|
||||
Stream_Read_INT32(s, packet.left);
|
||||
Stream_Read_INT32(s, packet.top);
|
||||
Stream_Read_INT32(s, packet.right);
|
||||
Stream_Read_INT32(s, packet.bottom);
|
||||
|
||||
Stream_Read_INT32(s, packet.topLevelLeft);
|
||||
Stream_Read_INT32(s, packet.topLevelTop);
|
||||
Stream_Read_INT32(s, packet.topLevelRight);
|
||||
Stream_Read_INT32(s, packet.topLevelBottom);
|
||||
|
||||
Stream_Read_UINT32(s, packet.geometryType);
|
||||
|
||||
Stream_Read_UINT32(s, cbGeometryBuffer);
|
||||
|
||||
if (Stream_GetRemainingLength(s) < cbGeometryBuffer)
|
||||
{
|
||||
WLog_ERR(TAG, "invalid packet length");
|
||||
@ -191,12 +190,16 @@ static UINT geometry_recv_pdu(GEOMETRY_CHANNEL_CALLBACK* callback, wStream* s)
|
||||
}
|
||||
|
||||
ZeroMemory(&packet.geometry, sizeof(packet.geometry));
|
||||
|
||||
if (cbGeometryBuffer)
|
||||
{
|
||||
ret = geometry_read_RGNDATA(s, cbGeometryBuffer, &packet.geometry);
|
||||
|
||||
if (ret != CHANNEL_RC_OK)
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
ret = CHANNEL_RC_OK;
|
||||
|
||||
if (context->MappedGeometryPacket)
|
||||
ret = context->MappedGeometryPacket(context, &packet);
|
||||
@ -210,10 +213,9 @@ static UINT geometry_recv_pdu(GEOMETRY_CHANNEL_CALLBACK* callback, wStream* s)
|
||||
*
|
||||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT geometry_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream *data)
|
||||
static UINT geometry_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, wStream* data)
|
||||
{
|
||||
GEOMETRY_CHANNEL_CALLBACK* callback = (GEOMETRY_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
return geometry_recv_pdu(callback, data);
|
||||
}
|
||||
|
||||
@ -239,7 +241,6 @@ static UINT geometry_on_new_channel_connection(IWTSListenerCallback* pListenerCa
|
||||
{
|
||||
GEOMETRY_CHANNEL_CALLBACK* callback;
|
||||
GEOMETRY_LISTENER_CALLBACK* listener_callback = (GEOMETRY_LISTENER_CALLBACK*) pListenerCallback;
|
||||
|
||||
callback = (GEOMETRY_CHANNEL_CALLBACK*) calloc(1, sizeof(GEOMETRY_CHANNEL_CALLBACK));
|
||||
|
||||
if (!callback)
|
||||
@ -254,9 +255,7 @@ static UINT geometry_on_new_channel_connection(IWTSListenerCallback* pListenerCa
|
||||
callback->channel_mgr = listener_callback->channel_mgr;
|
||||
callback->channel = pChannel;
|
||||
listener_callback->channel_callback = callback;
|
||||
|
||||
*ppCallback = (IWTSVirtualChannelCallback*) callback;
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
@ -269,8 +268,9 @@ static UINT geometry_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMa
|
||||
{
|
||||
UINT status;
|
||||
GEOMETRY_PLUGIN* geometry = (GEOMETRY_PLUGIN*) pPlugin;
|
||||
geometry->listener_callback = (GEOMETRY_LISTENER_CALLBACK*) calloc(1,
|
||||
sizeof(GEOMETRY_LISTENER_CALLBACK));
|
||||
|
||||
geometry->listener_callback = (GEOMETRY_LISTENER_CALLBACK*) calloc(1, sizeof(GEOMETRY_LISTENER_CALLBACK));
|
||||
if (!geometry->listener_callback)
|
||||
{
|
||||
WLog_ERR(TAG, "calloc failed!");
|
||||
@ -280,12 +280,9 @@ static UINT geometry_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelMa
|
||||
geometry->listener_callback->iface.OnNewChannelConnection = geometry_on_new_channel_connection;
|
||||
geometry->listener_callback->plugin = pPlugin;
|
||||
geometry->listener_callback->channel_mgr = pChannelMgr;
|
||||
|
||||
status = pChannelMgr->CreateListener(pChannelMgr, GEOMETRY_DVC_CHANNEL_NAME, 0,
|
||||
(IWTSListenerCallback*) geometry->listener_callback, &(geometry->listener));
|
||||
|
||||
geometry->listener->pInterface = geometry->iface.pInterface;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -324,11 +321,12 @@ UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
|
||||
UINT error = CHANNEL_RC_OK;
|
||||
GEOMETRY_PLUGIN* geometry;
|
||||
GeometryClientContext* context;
|
||||
|
||||
geometry = (GEOMETRY_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "geometry");
|
||||
|
||||
if (!geometry)
|
||||
{
|
||||
geometry = (GEOMETRY_PLUGIN*) calloc(1, sizeof(GEOMETRY_PLUGIN));
|
||||
|
||||
if (!geometry)
|
||||
{
|
||||
WLog_ERR(TAG, "calloc failed!");
|
||||
@ -339,8 +337,8 @@ UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
|
||||
geometry->iface.Connected = NULL;
|
||||
geometry->iface.Disconnected = NULL;
|
||||
geometry->iface.Terminated = geometry_plugin_terminated;
|
||||
|
||||
context = (GeometryClientContext*) calloc(1, sizeof(GeometryClientContext));
|
||||
|
||||
if (!context)
|
||||
{
|
||||
WLog_ERR(TAG, "calloc failed!");
|
||||
@ -349,10 +347,8 @@ UINT DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
|
||||
}
|
||||
|
||||
context->handle = (void*) geometry;
|
||||
|
||||
geometry->iface.pInterface = (void*) context;
|
||||
geometry->context = context;
|
||||
|
||||
error = pEntryPoints->RegisterPlugin(pEntryPoints, "geometry", (IWTSPlugin*) geometry);
|
||||
}
|
||||
else
|
||||
|
@ -2789,7 +2789,7 @@ LONG smartcard_unpack_locate_cards_by_atr_a_call(SMARTCARD_DEVICE* smartcard, wS
|
||||
|
||||
if (call->cReaders > 0)
|
||||
{
|
||||
call->rgReaderStates = (ReaderStateA*)calloc(call->cReaders, sizeof(SCARD_READERSTATEA));
|
||||
call->rgReaderStates = (ReaderStateA*)calloc(call->cReaders, sizeof(ReaderStateA));
|
||||
|
||||
if (!call->rgReaderStates)
|
||||
{
|
||||
|
@ -246,10 +246,7 @@ static void freerdp_client_print_command_line_args(COMMAND_LINE_ARGUMENT_A* arg)
|
||||
length += 2;
|
||||
|
||||
if (length >= 20 + 8 + 8)
|
||||
{
|
||||
length += 3 - strlen(arg->Format);
|
||||
overlong = TRUE;
|
||||
}
|
||||
|
||||
if (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL)
|
||||
printf("%s[:%s]", arg->Name, overlong ? "..." : arg->Format);
|
||||
@ -476,7 +473,6 @@ BOOL freerdp_client_add_device_channel(rdpSettings* settings, int count,
|
||||
|
||||
settings->RedirectSmartCards = TRUE;
|
||||
settings->DeviceRedirection = TRUE;
|
||||
|
||||
smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD));
|
||||
|
||||
if (!smartcard)
|
||||
@ -725,7 +721,8 @@ error_argv:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static char** freerdp_command_line_parse_comma_separated_values_ex(const char* name, const char* list,
|
||||
static char** freerdp_command_line_parse_comma_separated_values_ex(const char* name,
|
||||
const char* list,
|
||||
size_t* count)
|
||||
{
|
||||
char** p;
|
||||
@ -757,7 +754,8 @@ static char** freerdp_command_line_parse_comma_separated_values_ex(const char* n
|
||||
|
||||
{
|
||||
const char* it = list;
|
||||
while((it = strchr(it, ',')) != NULL)
|
||||
|
||||
while ((it = strchr(it, ',')) != NULL)
|
||||
{
|
||||
it++;
|
||||
nCommas++;
|
||||
@ -771,7 +769,7 @@ static char** freerdp_command_line_parse_comma_separated_values_ex(const char* n
|
||||
|
||||
prefix = (nArgs + 1UL) * sizeof(char*);
|
||||
len = strlen(list);
|
||||
p = (char**) calloc(len + prefix + 1, sizeof(char));
|
||||
p = (char**) calloc(len + prefix + 1, sizeof(char*));
|
||||
|
||||
if (!p)
|
||||
return NULL;
|
||||
@ -1760,6 +1758,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
WLog_ERR(TAG, "Smart sizing and dynamic resolution are mutually exclusive options");
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
}
|
||||
|
||||
settings->SupportDisplayControl = TRUE;
|
||||
settings->DynamicResolutionUpdate = TRUE;
|
||||
}
|
||||
|
@ -430,6 +430,10 @@ static BOOL certificate_process_server_public_signature(rdpCertificate* certific
|
||||
|
||||
#endif
|
||||
Stream_Read(s, encsig, siglen);
|
||||
|
||||
if (siglen < 8)
|
||||
return FALSE;
|
||||
|
||||
/* Last 8 bytes shall be all zero. */
|
||||
#if defined(CERT_VALIDATE_PADDING)
|
||||
|
||||
@ -443,10 +447,9 @@ static BOOL certificate_process_server_public_signature(rdpCertificate* certific
|
||||
}
|
||||
|
||||
#endif
|
||||
siglen -= 8;
|
||||
#if defined(CERT_VALIDATE_RSA)
|
||||
|
||||
if (crypto_rsa_public_decrypt(encsig, siglen, TSSK_KEY_LENGTH, tssk_modulus, tssk_exponent,
|
||||
if (crypto_rsa_public_decrypt(encsig, siglen - 8, TSSK_KEY_LENGTH, tssk_modulus, tssk_exponent,
|
||||
sig) <= 0)
|
||||
{
|
||||
WLog_ERR(TAG, "invalid RSA decrypt");
|
||||
|
@ -128,7 +128,9 @@ VOID winpr_CloseThreadpoolCleanupGroup(PTP_CLEANUP_GROUP ptpcg)
|
||||
if (ptpcg && ptpcg->groups)
|
||||
ArrayList_Free(ptpcg->groups);
|
||||
|
||||
if (ptpcg && ptpcg->env)
|
||||
ptpcg->env->CleanupGroup = NULL;
|
||||
|
||||
free(ptpcg);
|
||||
#endif
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ static BOOL test2(void)
|
||||
int index;
|
||||
PTP_POOL pool;
|
||||
PTP_WORK work;
|
||||
PTP_CLEANUP_GROUP cleanupGroup;
|
||||
PTP_CLEANUP_GROUP cleanupGroup = NULL;
|
||||
TP_CALLBACK_ENVIRON environment;
|
||||
printf("Private Thread Pool\n");
|
||||
|
||||
|
@ -12,7 +12,7 @@ int TestAcquireCredentialsHandle(int argc, char* argv[])
|
||||
{
|
||||
int rc = -1;
|
||||
SECURITY_STATUS status;
|
||||
CredHandle credentials;
|
||||
CredHandle credentials = { 0 };
|
||||
TimeStamp expiration;
|
||||
SEC_WINNT_AUTH_IDENTITY identity;
|
||||
SecurityFunctionTable* table;
|
||||
|
@ -17,7 +17,7 @@ int TestInitializeSecurityContext(int argc, char* argv[])
|
||||
CtxtHandle context;
|
||||
ULONG pfContextAttr;
|
||||
SECURITY_STATUS status;
|
||||
CredHandle credentials;
|
||||
CredHandle credentials = { 0 };
|
||||
TimeStamp expiration;
|
||||
PSecPkgInfo pPackageInfo;
|
||||
SEC_WINNT_AUTH_IDENTITY identity = { 0 };
|
||||
|
Loading…
Reference in New Issue
Block a user