chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
21236ab
)
util: refuse considering UID 0xFFFF and 0xFFFFFFFF valid
author
Lennart Poettering
<lennart@poettering.net>
Sun, 29 Jun 2014 20:15:33 +0000
(22:15 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Sun, 29 Jun 2014 20:27:07 +0000
(22:27 +0200)
src/shared/util.c
patch
|
blob
|
history
diff --git
a/src/shared/util.c
b/src/shared/util.c
index e7ff0f8840fdbe5d85c82e0c55d0367a4833c2b7..1709bb70ca3ab332894965d5034daea95de1319e 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-280,6
+280,14
@@
int parse_uid(const char *s, uid_t* ret_uid) {
if ((unsigned long) uid != ul)
return -ERANGE;
+ /* Some libc APIs use (uid_t) -1 as special placeholder */
+ if (uid == (uid_t) 0xFFFFFFFF)
+ return -EINVAL;
+
+ /* A long time ago UIDs where 16bit, hence explicitly avoid the 32bit -1 too */
+ if (uid == (uid_t) 0xFFFF)
+ return -EINVAL;
+
*ret_uid = uid;
return 0;
}