diff options
Diffstat (limited to 'distrib/special/doas/doas.c')
-rw-r--r-- | distrib/special/doas/doas.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/distrib/special/doas/doas.c b/distrib/special/doas/doas.c index c2fab7d4574..ade6afbdc2d 100644 --- a/distrib/special/doas/doas.c +++ b/distrib/special/doas/doas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: doas.c,v 1.3 2017/01/21 08:18:53 krw Exp $ */ +/* $OpenBSD: doas.c,v 1.4 2019/10/21 03:14:53 tedu Exp $ */ /* * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> * @@ -44,9 +44,11 @@ parseuid(const char *s, uid_t *uid) if ((pw = getpwnam(s)) != NULL) { *uid = pw->pw_uid; + if (*uid == UID_MAX) + return -1; return 0; } - *uid = strtonum(s, 0, UID_MAX, &errstr); + *uid = strtonum(s, 0, UID_MAX - 1, &errstr); if (errstr) return -1; return 0; |