17432413 Infinite /bin/sh exec loop in ksh93
authorTomas Klacko <tomas.klacko@oracle.com>
Wed, 13 Nov 2013 08:18:00 -0800
changeset 1549 f683981a3096
parent 1548 5c7ddc11be49
child 1550 31a9b2b667d6
17432413 Infinite /bin/sh exec loop in ksh93
components/ksh93/Makefile
components/ksh93/patches/17432413.patch
--- a/components/ksh93/Makefile	Mon Nov 11 23:00:17 2013 -0800
+++ b/components/ksh93/Makefile	Wed Nov 13 08:18:00 2013 -0800
@@ -77,7 +77,8 @@
 					 CR7175995.patch \
 					 CR7186440_ksh93_disable_predictive_editing.patch \
 					 CR7128313.patch  Bug15794787,15819673.patch \
-					 Bug15808407.patch Bug17714341.patch
+					 Bug15808407.patch Bug17714341.patch \
+					 17432413.patch
 
 # Fixup HOSTTYPE to match uname output and bits
 HOSTTYPE32=sol11.$(shell uname -p)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/17432413.patch	Wed Nov 13 08:18:00 2013 -0800
@@ -0,0 +1,23 @@
+--- a/src/cmd/ksh93/sh/init.c
++++ b/src/cmd/ksh93/sh/init.c
[email protected]@ -720,7 +720,7 @@ static char* get_lastarg(Namval_t* np, Namfun_t *fp)
+ 	char	*cp;
+ 	int	pid;
+         if(sh_isstate(SH_INIT) && (cp=shp->lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*')
+-		nv_putval(np,(pid==shp->gd->ppid?cp+1:0),0);
++		nv_putval(np,cp+1,0);
+ 	return(shp->lastarg);
+ }
+ 
+--- a/src/cmd/ksh93/sh/main.c
++++ b/src/cmd/ksh93/sh/main.c
[email protected]@ -298,7 +298,7 @@ int sh_main(int ac, char *av[], Shinit_f userinit)
+ 					 */
+ 					if (shp->st.repl_index > 0)
+ 						av[shp->st.repl_index] = shp->st.repl_arg;
+-					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (!(name = nv_getval(L_ARGNOD)) || !((type = sh_type(cp = name)) & SH_TYPE_SH)))
++					if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (name = nv_getval(L_ARGNOD)) && (!((type = sh_type(cp = name)) & SH_TYPE_SH)))
+ 					{
+ 						av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp);
+ 						/*  exec to change $0 for ps */
+