user-util: return malloc'ed strings in get_user_creds
get_user_creds would use getpwnam() and then returns strings pointing into the static buffer. This seems very iffy. Let's duplicate the strings properly
This commit is contained in:
+1
-1
@@ -196,7 +196,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
|
||||
break;
|
||||
|
||||
OPTION_LONG("uid", "USER", "Set user to send from"):
|
||||
r = get_user_creds(&opts.arg, &arg_uid, &arg_gid, NULL, NULL, 0);
|
||||
r = get_user_creds(opts.arg, /* flags= */ 0, NULL, &arg_uid, &arg_gid, NULL, NULL);
|
||||
if (r == -ESRCH) /* If the user doesn't exist, then accept it anyway as numeric */
|
||||
r = parse_uid(opts.arg, &arg_uid);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user