[warnings] fixed bugprone-not-null-terminated-result
This commit is contained in:
parent
a19305569d
commit
befa4233ad
@ -1176,7 +1176,8 @@ static UINT rdpdr_process_connect(rdpdrPlugin* rdpdr)
|
|||||||
if (!drive->Path)
|
if (!drive->Path)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOL hotplugAll = strncmp(drive->Path, "*", 2) == 0;
|
const char wildcard[] = "*";
|
||||||
|
BOOL hotplugAll = strncmp(drive->Path, wildcard, sizeof(wildcard)) == 0;
|
||||||
BOOL hotplugLater = strncmp(drive->Path, DynamicDrives, sizeof(DynamicDrives)) == 0;
|
BOOL hotplugLater = strncmp(drive->Path, DynamicDrives, sizeof(DynamicDrives)) == 0;
|
||||||
|
|
||||||
if (hotplugAll || hotplugLater)
|
if (hotplugAll || hotplugLater)
|
||||||
|
@ -539,13 +539,15 @@ int TestClientRdpFile(int argc, char* argv[])
|
|||||||
if (iValue != 456)
|
if (iValue != 456)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
const char microsoft[] = "microsoft";
|
||||||
sValue = freerdp_client_rdp_file_get_string_option(file, "vendor string");
|
sValue = freerdp_client_rdp_file_get_string_option(file, "vendor string");
|
||||||
if (strncmp(sValue, "microsoft", 10) != 0)
|
if (strncmp(sValue, microsoft, sizeof(microsoft)) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
const char apple[] = "apple";
|
||||||
freerdp_client_rdp_file_set_string_option(file, "vendor string", "apple");
|
freerdp_client_rdp_file_set_string_option(file, "vendor string", "apple");
|
||||||
sValue = freerdp_client_rdp_file_get_string_option(file, "vendor string");
|
sValue = freerdp_client_rdp_file_get_string_option(file, "vendor string");
|
||||||
if (strncmp(sValue, "apple", 6) != 0)
|
if (strncmp(sValue, apple, sizeof(apple)) != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
freerdp_client_rdp_file_set_string_option(file, "fruits", "banana,oranges");
|
freerdp_client_rdp_file_set_string_option(file, "fruits", "banana,oranges");
|
||||||
|
6
libfreerdp/cache/persistent.c
vendored
6
libfreerdp/cache/persistent.c
vendored
@ -42,6 +42,8 @@ struct rdp_persistent_cache
|
|||||||
UINT32 bmpSize;
|
UINT32 bmpSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char sig_str[] = "RDP8bmp";
|
||||||
|
|
||||||
int persistent_cache_get_version(rdpPersistentCache* persistent)
|
int persistent_cache_get_version(rdpPersistentCache* persistent)
|
||||||
{
|
{
|
||||||
WINPR_ASSERT(persistent);
|
WINPR_ASSERT(persistent);
|
||||||
@ -258,7 +260,7 @@ static int persistent_cache_open_read(rdpPersistentCache* persistent)
|
|||||||
if (fread(sig, 8, 1, persistent->fp) != 1)
|
if (fread(sig, 8, 1, persistent->fp) != 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!strncmp((const char*)sig, "RDP8bmp", 8))
|
if (memcmp(sig, sig_str, sizeof(sig_str)) == 0)
|
||||||
persistent->version = 3;
|
persistent->version = 3;
|
||||||
else
|
else
|
||||||
persistent->version = 2;
|
persistent->version = 2;
|
||||||
@ -298,7 +300,7 @@ static int persistent_cache_open_write(rdpPersistentCache* persistent)
|
|||||||
if (persistent->version == 3)
|
if (persistent->version == 3)
|
||||||
{
|
{
|
||||||
PERSISTENT_CACHE_HEADER_V3 header = { 0 };
|
PERSISTENT_CACHE_HEADER_V3 header = { 0 };
|
||||||
strncpy((char*)header.sig, "RDP8bmp", 8);
|
memcpy(header.sig, sig_str, MIN(sizeof(header.sig), sizeof(sig_str)));
|
||||||
header.flags = 0x00000006;
|
header.flags = 0x00000006;
|
||||||
|
|
||||||
if (fwrite(&header, sizeof(header), 1, persistent->fp) != 1)
|
if (fwrite(&header, sizeof(header), 1, persistent->fp) != 1)
|
||||||
|
@ -922,11 +922,12 @@ static const Mech* guessMech(PSecBuffer input_buffer, BOOL* spNego, WinPrAsn1_OI
|
|||||||
WinPrAsn1Decoder decoder;
|
WinPrAsn1Decoder decoder;
|
||||||
WinPrAsn1Decoder appDecoder;
|
WinPrAsn1Decoder appDecoder;
|
||||||
WinPrAsn1_tagId tag = 0;
|
WinPrAsn1_tagId tag = 0;
|
||||||
|
const char ssp[] = "NTLMSSP";
|
||||||
|
|
||||||
*spNego = FALSE;
|
*spNego = FALSE;
|
||||||
|
|
||||||
/* Check for NTLM token */
|
/* Check for NTLM token */
|
||||||
if (input_buffer->cbBuffer >= 8 && strncmp(input_buffer->pvBuffer, "NTLMSSP", 8) == 0)
|
if (input_buffer->cbBuffer >= 8 && strncmp(input_buffer->pvBuffer, ssp, sizeof(ssp)) == 0)
|
||||||
{
|
{
|
||||||
*oid = ntlm_OID;
|
*oid = ntlm_OID;
|
||||||
return negotiate_GetMechByOID(&ntlm_OID);
|
return negotiate_GetMechByOID(&ntlm_OID);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user