From 7fe27302ca1b955d97360f508b462470b593b0db Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 28 Jul 2015 21:10:58 +0000 Subject: Check uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX PR: 173977 Reported by: nvass@gmx.com --- pw/pw.c | 4 ++-- 1 file 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); -- cgit v1.2.3-56-ge451