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) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to