summaryrefslogtreecommitdiffstats
path: root/pw/pw.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-07-28 21:10:58 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-07-28 21:10:58 +0000
commit2ecea1d66f7cf56adf485dc082d7cd3ac361e50b (patch)
treee6e0a268f788f3a18e915694f0b6f32455427035 /pw/pw.c
parent4bdbd4b33ea7d6b88f1425f711bafd4ab04582c7 (diff)
downloadpw-darwin-2ecea1d66f7cf56adf485dc082d7cd3ac361e50b.tar.gz
pw-darwin-2ecea1d66f7cf56adf485dc082d7cd3ac361e50b.zip
Check uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX
PR: 173977 Reported by: nvass@gmx.com
Diffstat (limited to 'pw/pw.c')
-rw-r--r--pw/pw.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pw/pw.c b/pw/pw.c
index 3db427a..c1d9cd3 100644
--- a/pw/pw.c
+++ b/pw/pw.c
@@ -269,7 +269,7 @@ main(int argc, char *argv[])
}
if (strspn(optarg, "0123456789") != strlen(optarg))
errx(EX_USAGE, "-g expects a number");
- id = strtonum(optarg, 0, LONG_MAX, &errstr);
+ id = strtonum(optarg, 0, GID_MAX, &errstr);
if (errstr != NULL)
errx(EX_USAGE, "Bad id '%s': %s", optarg,
errstr);
@@ -281,7 +281,7 @@ main(int argc, char *argv[])
addarg(&arglist, 'u', optarg);
break;
}
- id = strtonum(optarg, 0, LONG_MAX, &errstr);
+ id = strtonum(optarg, 0, UID_MAX, &errstr);
if (errstr != NULL)
errx(EX_USAGE, "Bad id '%s': %s", optarg,
errstr);