vkd3d-common: Explicitly limit value to UINT_MAX in vkd3d_env_var_as_uint().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-04-08 11:05:36 +02:00 committed by Alexandre Julliard
parent abdaa20376
commit 18f8019fd9

View File

@ -22,6 +22,7 @@
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -310,7 +311,7 @@ unsigned int vkd3d_env_var_as_uint(const char *name, unsigned int default_value)
errno = 0;
r = strtoul(value, &end_ptr, 0);
if (!errno && end_ptr != value)
return r;
return min(r, UINT_MAX);
}
return default_value;