4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-21 00:07:36 +08:00

passwd: Fix potential buffer overflow

Fixes Coverity CID 66956

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2016-10-23 17:16:30 +02:00
parent 526107a753
commit 79edb254ac

View File

@ -592,7 +592,8 @@ main (int argc, char **argv)
return SetModals (xarg, narg, iarg, Larg, server);
}
strcpy (user, optind >= argc ? getlogin () : argv[optind]);
user[0] = '\0';
strncat (user, optind >= argc ? getlogin () : argv[optind], UNLEN);
/* Changing password for calling user? Use logonserver for user as well. */
if (!server && optind >= argc)