From 87189f48bb3ff275026600ac63f7f684d92a7f3a Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 28 Oct 2014 15:46:22 +0000 Subject: Ensure pw userdel -u do not try to remove root Check the uid passed is actually a number as early as possible MFC after: 1 week --- pw/pw_user.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pw/pw_user.c') diff --git a/pw/pw_user.c b/pw/pw_user.c index 0b56b81..483148a 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -321,6 +321,9 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) (a_uid = a_name)->ch = 'u'; a_name = NULL; } + } else { + if (strspn(a_uid->val, "0123456789") != strlen(a_uid->val)) + errx(EX_USAGE, "-u expects a number"); } /* -- cgit v1.2.3