logo

skeud

Simple and portable utilities to deal with user accounts (su, login)git clone https://anongit.hacktivis.me/git/skeud.git/
commit: 43250cd651ad96a1b50d06de1dccda647af69509
parent af92291786c15c4263e6fde408b75709d991ac5e
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 10 Nov 2025 09:17:53 +0100

su: fix passing NULL to chdir on undefined pw_dir

Diffstat:

Msu.c3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/su.c b/su.c @@ -215,9 +215,10 @@ main(int argc, char *argv[]) const char *home = pwent->pw_dir ? pwent->pw_dir : "/"; setenv("HOME", home, 1); + if(opt_l) { - if(chdir(pwent->pw_dir) != 0) perror("su: chdir"); + if(chdir(home) != 0) perror("su: chdir"); } explicit_bzero(pwent, sizeof(pwent));