Skip to content

Commit

Permalink
cd: validate $OLDPWD (Solaris patch 185-Bug17714341)
Browse files Browse the repository at this point in the history
This change was pulled in from:
https://raw.githubusercontent.com/oracle/solaris-userland/master/components/ksh93/patches/185-Bug17714341.patch

No public information about the reasons for this change is
available, but it seems reasonable to trust that the Solaris people
found a legitimate need for it.

src/cmd/ksh93/bltins/cd_pwd.c: b_cd():
- When determining the old PWD before 'cd', do not trust shp->pwd
  but get and validate the current PWD using path_pwd().
  • Loading branch information
McDutchie committed Jan 8, 2021
1 parent 1de20d6 commit 5d7e00a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/ksh93/bltins/cd_pwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int b_cd(int argc, char *argv[],Shbltin_t *context)
dir = argv[0];
if(error_info.errors>0 || argc >2)
errormsg(SH_DICT,ERROR_usage(2),"%s",optusage((char*)0));
oldpwd = (char*)shp->pwd;
oldpwd = path_pwd(shp,0);
opwdnod = (shp->subshell?sh_assignok(OLDPWDNOD,1):OLDPWDNOD);
pwdnod = (shp->subshell?sh_assignok(PWDNOD,1):PWDNOD);
if(argc==2)
Expand Down

0 comments on commit 5d7e00a

Please sign in to comment.