mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	sh_setmatch(): fix node size calculation
This fixes the function that sets ${.sh.match}. Patch from OpenSUSE:
https://build.opensuse.org/package/view_file/shells/ksh/ksh93-limit-name-len.dif
src/cmd/ksh93/sh/init.c: sh_setmatch():
- Fix node size calculation, possibly preventing data corruption.
src/cmd/ksh93/include/ulimit.h: Limit_t:
- Defining the 'name' struct member as 'char name[16]' makes
  no sense as the name is being initialised statically in
  data/limits.c; just make it a 'char *name' pointer.
			
			
This commit is contained in:
		
							parent
							
								
									3002c4113e
								
							
						
					
					
						commit
						9f980ba65a
					
				
					 2 changed files with 3 additions and 3 deletions
				
			
		|  | @ -157,7 +157,7 @@ | |||
| 
 | ||||
| typedef struct Limit_s | ||||
| { | ||||
| 	const char	name[16]; | ||||
| 	const char*	name; | ||||
| 	const char*	description; | ||||
| 	int		index; | ||||
| 	const char*	conf; | ||||
|  |  | |||
|  | @ -161,7 +161,7 @@ struct match | |||
| 	char		*val; | ||||
| 	char		*rval[2]; | ||||
| 	regoff_t	*match; | ||||
| 	char		node[NV_MINSZ+sizeof(char*)]; | ||||
| 	char		node[NV_MINSZ+sizeof(char*)+sizeof(Dtlink_t)]; | ||||
| 	regoff_t	first; | ||||
| 	int		vsize; | ||||
| 	int		nmatch; | ||||
|  | @ -721,7 +721,7 @@ static int hasgetdisc(register Namfun_t *fp) | |||
| void sh_setmatch(Shell_t *shp,const char *v, int vsize, int nmatch, regoff_t match[],int index) | ||||
| { | ||||
| 	struct match	*mp = &ip->SH_MATCH_init; | ||||
| 	Namval_t	*np = nv_namptr(mp->node,0);  | ||||
| 	Namval_t	*np = (Namval_t*)(&(mp->node[0])); | ||||
| 	register int	i,n,x; | ||||
| 	unsigned int	savesub = shp->subshell; | ||||
| 	Namarr_t	*ap = nv_arrayptr(SH_MATCHNOD); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue