diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2016-08-04 14:37:54 +0200 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2016-08-04 14:37:54 +0200 |
| commit | 32be80f46fd50ddb0c99efb4fe17f529ca5b8483 (patch) | |
| tree | e20308d24c632ab4150ef432adb1428233bbf3bc /common | |
| parent | 6be05d0ce72ee44748af900b5917f9b0b5837db8 (diff) | |
common: use strtoul in parse_color to avoid clamp
Some implementations of strtol may clamp the values to LONG_MAX instead of
wrapping around to negative values, so use strtoul instead to parse colors.
Diffstat (limited to 'common')
| -rw-r--r-- | common/util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/util.c b/common/util.c index 86120769..f0b0fdf0 100644 --- a/common/util.c +++ b/common/util.c @@ -104,7 +104,7 @@ uint32_t parse_color(const char *color) { sway_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color); return 0xFFFFFFFF; } - uint32_t res = (uint32_t)strtol(color + 1, NULL, 16); + uint32_t res = (uint32_t)strtoul(color + 1, NULL, 16); if (strlen(color) == 7) { res = (res << 8) | 0xFF; } |
