From 5fe20cf3212fbada86fb75cf13064caed6a5f3a9 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 1 Mar 2022 10:08:59 +0100 Subject: [PATCH] ash: do not truncate failed tilde expansion on unknown user names Do not skip over "*p = c;" statement. Testcase: echo ~~nouser/qwe function old new delta argstr 1396 1406 +10 Signed-off-by: Denys Vlasenko --- shell/ash.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shell/ash.c b/shell/ash.c index 44ec2eafd..ef4a47afe 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -6532,9 +6532,7 @@ exptilde(char *startp, int flag) home = lookupvar("HOME"); } else { pw = getpwnam(name); - if (pw == NULL) - goto lose; - home = pw->pw_dir; + home = pw ? pw->pw_dir : NULL; } *p = c; if (!home)