Tighter error checking for integer options in RDP file.

This commit is contained in:
Armin Novak 2019-09-11 11:45:59 +02:00
parent 5ca833fe66
commit 73897ebd3b

View File

@ -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;