components/ksh93/patches/105-CR7032068.patch
changeset 4305 90493abe0c5c
parent 4268 d723f8ed85fe
child 5129 5431772f7235
equal deleted inserted replaced
4304:b35bb72c479d 4305:90493abe0c5c
     1 This patch has been developed inhouse. This fixes a Solaris
     1 diff -rupN INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c INIT.2011-02-08/src/cmd/ksh93/sh/macro.c
     2 specific issue and has not been submitted to the community.
     2 --- INIT.2011-02-08.clean/src/cmd/ksh93/sh/macro.c	2012-05-02 03:34:48.830258020 -0700
     3 --- INIT.2012-08-01.old/src/cmd/ksh93/sh/macro.c	2015-02-24 13:25:19.363200741 -0800
     3 +++ INIT.2011-02-08/src/cmd/ksh93/sh/macro.c	2012-05-02 03:42:51.584924888 -0700
     4 +++ INIT.2012-08-01/src/cmd/ksh93/sh/macro.c	2015-03-05 11:11:46.044880541 -0800
     4 @@ -1084,7 +1084,7 @@ static int varsub(Mac_t *mp)
     5 @@ -1086,7 +1086,7 @@ static int varsub(Mac_t *mp)
       
     6  {
     5  {
     7  	register int	c;
     6  	register int	c;
     8  	register int	type=0; /* M_xxx */
     7  	register int	type=0; /* M_xxx */
     9 -	register char	*v,*argp=0;
     8 -	register char	*v,*argp=0;
    10 +	register char	*v, *new_v = NULL, *argp=0;
     9 +	register char	*v, *new_v = NULL, *argp=0;
    11  	register Namval_t	*np = NIL(Namval_t*);
    10  	register Namval_t	*np = NIL(Namval_t*);
    12  	register int 	dolg=0, mode=0;
    11  	register int 	dolg=0, mode=0;
    13  	Lex_t		*lp = (Lex_t*)mp->shp->lex_context;
    12  	Lex_t		*lp = (Lex_t*)mp->shp->lex_context;
    14 @@ -1439,6 +1439,7 @@ retry1:
    13 @@ -1436,6 +1436,7 @@ retry1:
    15  				if((mp->let || (mp->arith&&nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL)))) && !nv_isattr(np,NV_INTEGER) && (offset==0 || isspace(c) || strchr(",.+-*/=%&|^?!<>",c)))
    14  				if( (mp->arith||mp->let) && (np->nvfun || nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL))) && !nv_isattr(np,NV_INTEGER) && (offset==0 || !isalnum(c)))
    16  					mp->zeros = 1;
    15  					mp->zeros = 1;
    17  			}
    16  			}
    18 +			new_v = v = strdup(v);
    17 +			new_v = v = strdup(v);
    19  			if(savptr==stakptr(0))
    18  			if(savptr==stakptr(0))
    20  				stkseek(stkp,offset);
    19  				stkseek(stkp,offset);
    21  			else
    20  			else
    22 @@ -1989,6 +1990,8 @@ retry2:
    21 @@ -1963,8 +1964,12 @@ retry2:
    23  	}
    22  	}
    24  	if(np)
    23  	if(np)
    25  		nv_close(np);
    24  		nv_close(np);
    26 +	if (new_v)
    25 + 	if (new_v)
    27 +		free(new_v);
    26 +		free(new_v);
    28  	if(pattern)
       
    29  		free(pattern);
       
    30  	if(repstr)
       
    31 @@ -1997,6 +2000,8 @@ retry2:
       
    32  		free(idx);
       
    33  	return(1);
    27  	return(1);
    34  nosub:
    28  nosub:
    35 +	if (new_v)
    29 +	if (new_v)
    36 +		free(new_v);
    30 +		free(new_v);
    37  	if(type==M_BRACE && sh_lexstates[ST_NORM][c]==S_BREAK)
    31  	if(type==M_BRACE && sh_lexstates[ST_NORM][c]==S_BREAK)