[core,info] 0 check cbClientAddress and cbClientDir
if one of the above values is 0 do not add the size for the '\0'
@@ -484,6 +484,8 @@ static BOOL rdp_write_extended_info_packet(rdpRdp* rdp, wStream* s)
if (cbClientAddress > (UINT16_MAX / sizeof(WCHAR)))
goto fail;
+ if (cbClientAddress > 0)
+ {
cbClientAddress = (UINT16)(cbClientAddress + 1) * sizeof(WCHAR);
if (cbClientAddress > cbClientAddressMax)
{
@@ -495,21 +497,26 @@ static BOOL rdp_write_extended_info_packet(rdpRdp* rdp, wStream* s)
clientAddress[(cbClientAddressMax / sizeof(WCHAR)) - 1] = '\0';
cbClientAddress = cbClientAddressMax;
}
+ }
clientDir = ConvertUtf8ToWCharAlloc(settings->ClientDir, &cbClientDir);
if (cbClientDir > (UINT16_MAX / sizeof(WCHAR)))
goto fail;
+ if (cbClientDir > 0)
+ {
cbClientDir = (UINT16)(cbClientDir + 1) * sizeof(WCHAR);
if (cbClientDir > cbClientDirMax)
{
- WLog_WARN(
- TAG, "[%s] the client dir %s [%" PRIuz "] exceeds the limit of %" PRIuz ", truncating.",
+ WLog_WARN(TAG,
+ "[%s] the client dir %s [%" PRIuz "] exceeds the limit of %" PRIuz
+ ", truncating.",
__FUNCTION__, settings->ClientDir, cbClientDir, cbClientDirMax);
clientDir[(cbClientDirMax / sizeof(WCHAR)) - 1] = '\0';
cbClientDir = cbClientDirMax;
}
+ }
if (settings->ServerAutoReconnectCookie->cbLen > UINT16_MAX)
goto fail;
