mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-22 20:50:35 +01:00
util: check for < 0 explicitly in safe_atou
The previous check only worked if sizeof(long) > sizeof(int). Rather than be fancy about it, just cast to a signed long, check for negativity and continue based on that. Fixes #137 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
d616218c9a
commit
c501dabf39
1 changed files with 1 additions and 1 deletions
|
|
@ -538,7 +538,7 @@ safe_atou_base(const char *str, unsigned int *val, int base)
|
|||
if (*str != '\0' && *endptr != '\0')
|
||||
return false;
|
||||
|
||||
if (v > UINT_MAX)
|
||||
if ((long)v < 0)
|
||||
return false;
|
||||
|
||||
*val = v;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue