r249408 and r249436 cause a NULL pointer dereference on the CUBIEBOARD

since it doesn't set the kernel envrionment at all. Work around this
by making sure kern_envp is non-NULL before dereferencing it.
This commit is contained in:
Warner Losh 2013-04-16 22:09:08 +00:00
parent 12087a0769
commit 11c601447d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=249570

View File

@ -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 (*kern_envp != '\0') {
if (kern_envp && *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) {