Fixed NULL buffer access and alignment warnings.
This commit is contained in:
parent
ddb811cbc8
commit
14dfb99a6f
@ -61,13 +61,15 @@ static BYTE BOM_UTF16_LE[2] = { 0xFF, 0xFE };
|
|||||||
|
|
||||||
struct rdp_file_line
|
struct rdp_file_line
|
||||||
{
|
{
|
||||||
size_t index;
|
|
||||||
char* text;
|
char* text;
|
||||||
DWORD flags;
|
|
||||||
char* name;
|
char* name;
|
||||||
LPSTR sValue;
|
LPSTR sValue;
|
||||||
long iValue;
|
|
||||||
PBYTE bValue;
|
PBYTE bValue;
|
||||||
|
|
||||||
|
size_t index;
|
||||||
|
|
||||||
|
long iValue;
|
||||||
|
DWORD flags;
|
||||||
int valueLength;
|
int valueLength;
|
||||||
};
|
};
|
||||||
typedef struct rdp_file_line rdpFileLine;
|
typedef struct rdp_file_line rdpFileLine;
|
||||||
@ -117,6 +119,8 @@ struct rdp_file
|
|||||||
DWORD BitmapCacheSize; /* bitmapcachesize */
|
DWORD BitmapCacheSize; /* bitmapcachesize */
|
||||||
DWORD BitmapCachePersistEnable; /* bitmapcachepersistenable */
|
DWORD BitmapCachePersistEnable; /* bitmapcachepersistenable */
|
||||||
|
|
||||||
|
DWORD ServerPort; /* server port */
|
||||||
|
|
||||||
LPSTR Username; /* username */
|
LPSTR Username; /* username */
|
||||||
LPSTR Domain; /* domain */
|
LPSTR Domain; /* domain */
|
||||||
LPSTR Password; /*password*/
|
LPSTR Password; /*password*/
|
||||||
@ -124,8 +128,8 @@ struct rdp_file
|
|||||||
|
|
||||||
LPSTR FullAddress; /* full address */
|
LPSTR FullAddress; /* full address */
|
||||||
LPSTR AlternateFullAddress; /* alternate full address */
|
LPSTR AlternateFullAddress; /* alternate full address */
|
||||||
DWORD ServerPort; /* server port */
|
|
||||||
|
|
||||||
|
LPSTR UsbDevicesToRedirect; /* usbdevicestoredirect */
|
||||||
DWORD RedirectDrives; /* redirectdrives */
|
DWORD RedirectDrives; /* redirectdrives */
|
||||||
DWORD RedirectPrinters; /* redirectprinters */
|
DWORD RedirectPrinters; /* redirectprinters */
|
||||||
DWORD RedirectComPorts; /* redirectcomports */
|
DWORD RedirectComPorts; /* redirectcomports */
|
||||||
@ -135,7 +139,6 @@ struct rdp_file
|
|||||||
DWORD RedirectDirectX; /* redirectdirectx */
|
DWORD RedirectDirectX; /* redirectdirectx */
|
||||||
DWORD DisablePrinterRedirection; /* disableprinterredirection */
|
DWORD DisablePrinterRedirection; /* disableprinterredirection */
|
||||||
DWORD DisableClipboardRedirection; /* disableclipboardredirection */
|
DWORD DisableClipboardRedirection; /* disableclipboardredirection */
|
||||||
LPSTR UsbDevicesToRedirect; /* usbdevicestoredirect */
|
|
||||||
|
|
||||||
DWORD ConnectToConsole; /* connect to console */
|
DWORD ConnectToConsole; /* connect to console */
|
||||||
DWORD AdministrativeSession; /* administrative session */
|
DWORD AdministrativeSession; /* administrative session */
|
||||||
@ -148,9 +151,10 @@ struct rdp_file
|
|||||||
DWORD PromptForCredentials; /* prompt for credentials */
|
DWORD PromptForCredentials; /* prompt for credentials */
|
||||||
DWORD NegotiateSecurityLayer; /* negotiate security layer */
|
DWORD NegotiateSecurityLayer; /* negotiate security layer */
|
||||||
DWORD EnableCredSSPSupport; /* enablecredsspsupport */
|
DWORD EnableCredSSPSupport; /* enablecredsspsupport */
|
||||||
LPSTR LoadBalanceInfo; /* loadbalanceinfo */
|
|
||||||
|
|
||||||
DWORD RemoteApplicationMode; /* remoteapplicationmode */
|
DWORD RemoteApplicationMode; /* remoteapplicationmode */
|
||||||
|
LPSTR LoadBalanceInfo; /* loadbalanceinfo */
|
||||||
|
|
||||||
LPSTR RemoteApplicationName; /* remoteapplicationname */
|
LPSTR RemoteApplicationName; /* remoteapplicationname */
|
||||||
LPSTR RemoteApplicationIcon; /* remoteapplicationicon */
|
LPSTR RemoteApplicationIcon; /* remoteapplicationicon */
|
||||||
LPSTR RemoteApplicationProgram; /* remoteapplicationprogram */
|
LPSTR RemoteApplicationProgram; /* remoteapplicationprogram */
|
||||||
@ -169,12 +173,10 @@ struct rdp_file
|
|||||||
DWORD GatewayUsageMethod; /* gatewayusagemethod */
|
DWORD GatewayUsageMethod; /* gatewayusagemethod */
|
||||||
DWORD GatewayProfileUsageMethod; /* gatewayprofileusagemethod */
|
DWORD GatewayProfileUsageMethod; /* gatewayprofileusagemethod */
|
||||||
DWORD GatewayCredentialsSource; /* gatewaycredentialssource */
|
DWORD GatewayCredentialsSource; /* gatewaycredentialssource */
|
||||||
LPSTR GatewayAccessToken; /* gatewayaccesstoken */
|
|
||||||
|
|
||||||
DWORD UseRedirectionServerName; /* use redirection server name */
|
DWORD UseRedirectionServerName; /* use redirection server name */
|
||||||
|
|
||||||
DWORD RdgIsKdcProxy; /* rdgiskdcproxy */
|
LPSTR GatewayAccessToken; /* gatewayaccesstoken */
|
||||||
LPSTR KdcProxyName; /* kdcproxyname */
|
|
||||||
|
|
||||||
LPSTR DrivesToRedirect; /* drivestoredirect */
|
LPSTR DrivesToRedirect; /* drivestoredirect */
|
||||||
LPSTR DevicesToRedirect; /* devicestoredirect */
|
LPSTR DevicesToRedirect; /* devicestoredirect */
|
||||||
@ -182,6 +184,11 @@ struct rdp_file
|
|||||||
|
|
||||||
LPSTR PreconnectionBlob; /* pcb */
|
LPSTR PreconnectionBlob; /* pcb */
|
||||||
|
|
||||||
|
LPSTR KdcProxyName; /* kdcproxyname */
|
||||||
|
DWORD RdgIsKdcProxy; /* rdgiskdcproxy */
|
||||||
|
|
||||||
|
DWORD align1;
|
||||||
|
|
||||||
size_t lineCount;
|
size_t lineCount;
|
||||||
size_t lineSize;
|
size_t lineSize;
|
||||||
rdpFileLine* lines;
|
rdpFileLine* lines;
|
||||||
@ -881,11 +888,20 @@ static SSIZE_T freerdp_client_write_setting_to_buffer(char** buffer, size_t* buf
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
SSIZE_T len;
|
SSIZE_T len;
|
||||||
char* buf = *buffer;
|
char* buf;
|
||||||
size_t bufSize = *bufferSize;
|
size_t bufSize;
|
||||||
|
|
||||||
|
if (!buffer || !bufferSize || !fmt)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
buf = *buffer;
|
||||||
|
bufSize = *bufferSize;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
len = vsnprintf(buf, bufSize, fmt, ap);
|
len = vsnprintf(buf, bufSize, fmt, ap);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -897,6 +913,9 @@ static SSIZE_T freerdp_client_write_setting_to_buffer(char** buffer, size_t* buf
|
|||||||
if (!buf && !bufSize)
|
if (!buf && !bufSize)
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
return -1;
|
||||||
|
|
||||||
/* update buffer size and buffer position and replace \0 with \n */
|
/* update buffer size and buffer position and replace \0 with \n */
|
||||||
if (bufSize >= (size_t)len)
|
if (bufSize >= (size_t)len)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user