summaryrefslogtreecommitdiffstats
path: root/pw/pw.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-06-07 19:33:25 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-06-07 19:33:25 +0000
commitfd1b4fc5f4c3f3eb1ee87ab1f07b7640efd15792 (patch)
tree021a93deb9a9c3dc06d5d56be3addb65fa7c988c /pw/pw.c
parentecddcdd12d894cb5522d8c22536d53f1c8cce857 (diff)
downloadpw-darwin-fd1b4fc5f4c3f3eb1ee87ab1f07b7640efd15792.tar.gz
pw-darwin-fd1b4fc5f4c3f3eb1ee87ab1f07b7640efd15792.tar.zst
pw-darwin-fd1b4fc5f4c3f3eb1ee87ab1f07b7640efd15792.zip
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 'pw/pw.c')
-rw-r--r--pw/pw.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pw/pw.c b/pw/pw.c
index 7274c32..ae030ec 100644
--- a/pw/pw.c
+++ b/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;