mirror of
https://github.com/slicer69/doas
synced 2024-10-02 22:25:19 +00:00
Correct initializer - targetname[0] is access even when no 'u' option is given
This commit is contained in:
parent
9a4eb403de
commit
f121a2e063
2
doas.c
2
doas.c
|
@ -302,6 +302,7 @@ main(int argc, char **argv)
|
|||
closefrom(STDERR_FILENO + 1);
|
||||
|
||||
uid = getuid();
|
||||
targetname[0] = '\0';
|
||||
|
||||
while ((ch = getopt(argc, argv, "+a:C:nSsu:")) != -1) {
|
||||
switch (ch) {
|
||||
|
@ -320,7 +321,6 @@ main(int argc, char **argv)
|
|||
exit(i != -1);
|
||||
*/
|
||||
case 'u':
|
||||
targetname[0] = '\0';
|
||||
if (strlcpy(targetname, optarg, sizeof(targetname)) >= sizeof(targetname))
|
||||
errx(1, "pw_name too long");
|
||||
if (parseuid(targetname, &target) != 0)
|
||||
|
|
Loading…
Reference in a new issue