Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Apr 2013 07:23:37 +0000 (UTC)
From:      "Jayachandran C." <jchandra@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r249436 - head/sys/kern
Message-ID:  <201304130723.r3D7Nbnr042463@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jchandra
Date: Sat Apr 13 07:23:37 2013
New Revision: 249436
URL: http://svnweb.freebsd.org/changeset/base/249436

Log:
  Fix changes made in r249408.
  
  In some cases, kern_envp is set by the architecture code and env_pos does
  not contain the length of the static kernel environment. In these cases
  r249408 causes the kernel to discard the environment.
  
  Fix this by updating the check for empty static env to *kern_envp != '\0'
  
  Reported by:	np@

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c	Sat Apr 13 05:11:21 2013	(r249435)
+++ head/sys/kern/kern_environment.c	Sat Apr 13 07:23:37 2013	(r249436)
@@ -231,7 +231,7 @@ init_dynamic_kenv(void *data __unused)
 	kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV,
 		M_WAITOK | M_ZERO);
 	i = 0;
-	if (env_pos > 0) {
+	if (*kern_envp != '\0') {
 		for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
 			len = strlen(cp) + 1;
 			if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304130723.r3D7Nbnr042463>