Merge pull request #3076 from akallabeth/remove_fixed_size_heap_strings
Removed fixed size strings.
This commit is contained in:
commit
8ec39039e5
@ -198,14 +198,22 @@ BOOL rdg_send_tunnel_authorization(rdpRdg* rdg)
|
||||
int i;
|
||||
wStream* s;
|
||||
BOOL status;
|
||||
char* clientName = rdg->settings->ClientHostname;
|
||||
UINT16 clientNameLen = strlen(clientName) + 1;
|
||||
UINT32 packetSize = 12 + clientNameLen * 2;
|
||||
WCHAR* clientName = NULL;
|
||||
UINT16 clientNameLen;
|
||||
UINT32 packetSize;
|
||||
|
||||
clientNameLen = ConvertToUnicode(CP_UTF8, 0, rdg->settings->ClientHostname, -1, &clientName, 0);
|
||||
if (!clientName)
|
||||
return FALSE;
|
||||
|
||||
packetSize = 12 + clientNameLen * 2 + sizeof(WCHAR);
|
||||
s = Stream_New(NULL, packetSize);
|
||||
|
||||
if (!s)
|
||||
{
|
||||
free(clientName);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Stream_Write_UINT16(s, PKT_TYPE_TUNNEL_AUTH); /* Type (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* Reserved (2 bytes) */
|
||||
@ -215,15 +223,16 @@ BOOL rdg_send_tunnel_authorization(rdpRdg* rdg)
|
||||
Stream_Write_UINT16(s, clientNameLen * 2); /* Client name string length */
|
||||
|
||||
for (i = 0; i < clientNameLen; i++)
|
||||
{
|
||||
Stream_Write_UINT16(s, clientName[i]);
|
||||
}
|
||||
|
||||
Stream_Write_UINT16(s, 0);
|
||||
|
||||
Stream_SealLength(s);
|
||||
|
||||
status = rdg_write_packet(rdg, s);
|
||||
|
||||
Stream_Free(s, TRUE);
|
||||
free(clientName);
|
||||
|
||||
if (status)
|
||||
{
|
||||
|
@ -591,8 +591,8 @@ BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
|
||||
/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */
|
||||
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), 32 / 2, &str, 0, NULL, NULL);
|
||||
Stream_Seek(s, 32);
|
||||
sprintf_s(settings->ClientHostname, 31, "%s", str);
|
||||
settings->ClientHostname[31] = 0;
|
||||
free(settings->ClientHostname);
|
||||
settings->ClientHostname = str;
|
||||
free(str);
|
||||
str = NULL;
|
||||
|
||||
@ -649,8 +649,8 @@ BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength)
|
||||
|
||||
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), 64 / 2, &str, 0, NULL, NULL);
|
||||
Stream_Seek(s, 64); /* clientDigProductId (64 bytes) */
|
||||
sprintf_s(settings->ClientProductId, 32, "%s", str);
|
||||
free(str);
|
||||
free(settings->ClientProductId);
|
||||
settings->ClientProductId = str;
|
||||
blockLength -= 64;
|
||||
|
||||
if (blockLength < 1)
|
||||
|
@ -732,14 +732,12 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
|
||||
CopyMemory(_settings->ReceivedCapabilities, settings->ReceivedCapabilities, 32);
|
||||
CopyMemory(_settings->OrderSupport, settings->OrderSupport, 32);
|
||||
|
||||
_settings->ClientHostname = malloc(32);
|
||||
_settings->ClientHostname = _strdup(settings->ClientHostname);
|
||||
if (!_settings->ClientHostname)
|
||||
goto out_fail;
|
||||
_settings->ClientProductId = malloc(32);
|
||||
_settings->ClientProductId = _strdup(settings->ClientProductId);
|
||||
if (!_settings->ClientProductId)
|
||||
goto out_fail;
|
||||
CopyMemory(_settings->ClientHostname, settings->ClientHostname, 32);
|
||||
CopyMemory(_settings->ClientProductId, settings->ClientProductId, 32);
|
||||
|
||||
_settings->BitmapCacheV2CellInfo = (BITMAP_CACHE_V2_CELL_INFO*) malloc(sizeof(BITMAP_CACHE_V2_CELL_INFO) * 6);
|
||||
if (!_settings->BitmapCacheV2CellInfo)
|
||||
|
Loading…
Reference in New Issue
Block a user