projects
/
platform
/
upstream
/
libinput.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d616218
)
util: check for < 0 explicitly in safe_atou
author
Peter Hutterer
<peter.hutterer@who-t.net>
Wed, 12 Sep 2018 22:18:16 +0000
(08:18 +1000)
committer
Peter Hutterer
<peter.hutterer@who-t.net>
Wed, 12 Sep 2018 22:32:23 +0000
(08:32 +1000)
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>
src/libinput-util.h
patch
|
blob
|
history
diff --git
a/src/libinput-util.h
b/src/libinput-util.h
index ff8d56fbeabad99e5872e49d1cec201b3985bf36..360e3906801b665728d367f15c6db6783145ce29 100644
(file)
--- a/
src/libinput-util.h
+++ b/
src/libinput-util.h
@@
-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;