mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Tighter error checking for integer options in RDP file.
This commit is contained in:
@@ -370,11 +370,13 @@ static BOOL freerdp_client_rdp_file_set_integer(rdpFile* file, const char* name,
|
||||
static BOOL freerdp_client_parse_rdp_file_integer(rdpFile* file, const char* name,
|
||||
const char* value, SSIZE_T index)
|
||||
{
|
||||
char* endptr;
|
||||
long ivalue;
|
||||
errno = 0;
|
||||
ivalue = strtol(value, NULL, 0);
|
||||
ivalue = strtol(value, &endptr, 0);
|
||||
|
||||
if ((errno != 0) || (ivalue > INT32_MAX) || (ivalue < INT32_MIN))
|
||||
if ((endptr == NULL) || (errno != 0) || (endptr == value) ||
|
||||
(ivalue > INT32_MAX) || (ivalue < INT32_MIN))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to convert RDP file integer option %s [value=%s]", name, value);
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user