summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/pw.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-06-07 19:33:25 +0000
committerbapt <bapt@FreeBSD.org>2015-06-07 19:33:25 +0000
commit4a60f5b2aa32e78ca47b6bda0c8df390f7116df0 (patch)
treeaf0c53a2d8eb41aa0ee99a6dfe9e5a97cced6861 /usr.sbin/pw/pw.c
parent3be2bba5d71e59e56e7e8ba65e3c4efe3e59380f (diff)
downloadFreeBSD-src-4a60f5b2aa32e78ca47b6bda0c8df390f7116df0.zip
FreeBSD-src-4a60f5b2aa32e78ca47b6bda0c8df390f7116df0.tar.gz
In case of rename validate the length of the new name
Check early that the new name fits MAXLOGNAME and store it in pwconf
Diffstat (limited to 'usr.sbin/pw/pw.c')
-rw-r--r--usr.sbin/pw/pw.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c
index 7274c32..ae030ec 100644
--- a/usr.sbin/pw/pw.c
+++ b/usr.sbin/pw/pw.c
@@ -234,6 +234,11 @@ main(int argc, char *argv[])
case 'N':
conf.dryrun = true;
break;
+ case 'l':
+ if (strlen(optarg) >= MAXLOGNAME)
+ errx(EX_USAGE, "new name too long: %s", optarg);
+ conf.newname = optarg;
+ break;
case 'P':
conf.pretty = true;
break;
OpenPOWER on IntegriCloud