Merge pull request #5589 from akallabeth/strtol_error_check

Tighter error checking for integer options in RDP file.
This commit is contained in:
Martin Fleisz 2019-09-11 14:33:10 +02:00 committed by GitHub
commit ac8be3cdcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

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;