summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorBryce Harrington <bryce@osg.samsung.com>2016-07-13 13:27:29 -0700
committerBryce Harrington <bryce@osg.samsung.com>2016-07-13 14:40:28 -0700
commit03793e39989d670b10e4698f74235b478be9caf7 (patch)
tree888c8a9a58eba0cc652b05abc55f32e8912b3126 /shared
parenta8d987d93c9250601901aa2dd713b51447db8aa8 (diff)
Revert "config-parser: Catch negative numbers assigned to unsigned config values"
The reduction in range limits does have an effect for color values, which are expressed as hexadecimal values from 0x00000000 to 0xFFFFFFFF. By limiting the range to INT_MAX, color values of 0x80000000 and up are in fact lost. This reverts commit 6351fb08c2e302f8696b2022830e5317e7219c39. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Acked-by: Derek Foreman <derekf@osg.samsung.com> Tested-by: Yong Bakos <ybakos@humanoriented.com>
Diffstat (limited to 'shared')
-rw-r--r--shared/config-parser.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/shared/config-parser.c b/shared/config-parser.c
index 4c672206..1e08759e 100644
--- a/shared/config-parser.c
+++ b/shared/config-parser.c
@@ -186,7 +186,6 @@ weston_config_section_get_uint(struct weston_config_section *section,
const char *key,
uint32_t *value, uint32_t default_value)
{
- long int ret;
struct weston_config_entry *entry;
char *end;
@@ -198,22 +197,13 @@ weston_config_section_get_uint(struct weston_config_section *section,
}
errno = 0;
- ret = strtol(entry->value, &end, 0);
+ *value = strtoul(entry->value, &end, 0);
if (errno != 0 || end == entry->value || *end != '\0') {
*value = default_value;
errno = EINVAL;
return -1;
}
- /* check range */
- if (ret < 0 || ret > INT_MAX) {
- *value = default_value;
- errno = ERANGE;
- return -1;
- }
-
- *value = ret;
-
return 0;
}