* environ.cc (build_env): Use "kilo"bytes not "mega"bytes. Return immediately
on error. * spawn.cc (spawn_guts): Set return value to -1 on error from build_env.
This commit is contained in:
		| @@ -1,3 +1,10 @@ | |||||||
|  | 2005-09-16  Christopher Faylor  <cgf@timesys.com> | ||||||
|  |  | ||||||
|  | 	* environ.cc (build_env): Use "kilo"bytes not "mega"bytes.  Return | ||||||
|  | 	immediately on error. | ||||||
|  | 	* spawn.cc (spawn_guts): Set return value to -1 on error from | ||||||
|  | 	build_env. | ||||||
|  |  | ||||||
| 2005-09-16  Christopher Faylor  <cgf@timesys.com> | 2005-09-16  Christopher Faylor  <cgf@timesys.com> | ||||||
|  |  | ||||||
| 	* environ.cc (build_env): Clear envblock and return NULL on attempt to | 	* environ.cc (build_env): Clear envblock and return NULL on attempt to | ||||||
|   | |||||||
| @@ -1034,11 +1034,11 @@ build_env (const char * const *envp, char *&envblock, int &envc, | |||||||
| 	    p = *srcp;		/* Don't worry about it */ | 	    p = *srcp;		/* Don't worry about it */ | ||||||
|  |  | ||||||
| 	  len = strlen (p); | 	  len = strlen (p); | ||||||
| 	  if (len >= 32 * 1024 * 1024) | 	  if (len >= 32 * 1024) | ||||||
| 	    { | 	    { | ||||||
| 	      free (envblock); | 	      free (envblock); | ||||||
| 	      envblock = NULL; | 	      envblock = NULL; | ||||||
| 	      break; | 	      goto out; | ||||||
| 	    } | 	    } | ||||||
| 	  new_tl += len + 1;	/* Keep running total of block length so far */ | 	  new_tl += len + 1;	/* Keep running total of block length so far */ | ||||||
|  |  | ||||||
| @@ -1072,6 +1072,7 @@ build_env (const char * const *envp, char *&envblock, int &envc, | |||||||
| 					   of buffer */ | 					   of buffer */ | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | out: | ||||||
|   debug_printf ("envp %p, envc %d", newenv, envc); |   debug_printf ("envp %p, envc %d", newenv, envc); | ||||||
|   return newenv; |   return newenv; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -627,6 +627,7 @@ spawn_guts (const char * prog_arg, const char *const *argv, | |||||||
|   if (!moreinfo->envp || !envblock) |   if (!moreinfo->envp || !envblock) | ||||||
|     { |     { | ||||||
|       set_errno (E2BIG); |       set_errno (E2BIG); | ||||||
|  |       res = -1; | ||||||
|       goto out; |       goto out; | ||||||
|     } |     } | ||||||
|   ciresrv.set (chtype, real_path.iscygexec ()); |   ciresrv.set (chtype, real_path.iscygexec ()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user