mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-24 22:34:29 +02:00
config: make sure word marker trailing in environment is zero
This commit is contained in:
parent
3d1ba0d486
commit
a0549a395e
@ -2423,6 +2423,8 @@ RestartInput:
|
|||||||
fstrcpy(envp, buffer);
|
fstrcpy(envp, buffer);
|
||||||
envp += len + 1;
|
envp += len + 1;
|
||||||
*envp = 0;
|
*envp = 0;
|
||||||
|
envp[1] = 0;
|
||||||
|
envp[2] = 0;
|
||||||
}
|
}
|
||||||
if (MenuColor != -1)
|
if (MenuColor != -1)
|
||||||
ClearScreen(0x7);
|
ClearScreen(0x7);
|
||||||
@ -2749,11 +2751,15 @@ STATIC VOID CmdSet(BYTE *pLine)
|
|||||||
pLine = skipwh(++pLine);
|
pLine = skipwh(++pLine);
|
||||||
strcat(szBuf, pLine); /* append the variable value (may include spaces) */
|
strcat(szBuf, pLine); /* append the variable value (may include spaces) */
|
||||||
size = strlen(szBuf);
|
size = strlen(szBuf);
|
||||||
if (size < master_env + sizeof(master_env) - envp - 1)
|
if (size < master_env + sizeof(master_env) - envp - 1 - 2)
|
||||||
{ /* must end with two consequtive zeros */
|
{ /* must end with two consequtive zeros */
|
||||||
fstrcpy(envp, szBuf);
|
fstrcpy(envp, szBuf);
|
||||||
envp += size + 1; /* add next variables starting at the second zero */
|
envp += size + 1; /* add next variables starting at the second zero */
|
||||||
*envp = 0;
|
*envp = 0;
|
||||||
|
envp[1] = 0;
|
||||||
|
envp[2] = 0;
|
||||||
|
/* The word marker after last variable should not equal 1,
|
||||||
|
to indicate that there is no executable pathname following. */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("Master environment is full - can't add \"%s\"\n", szBuf);
|
printf("Master environment is full - can't add \"%s\"\n", szBuf);
|
||||||
|
@ -466,7 +466,7 @@ STATIC void kernel()
|
|||||||
CommandTail Cmd;
|
CommandTail Cmd;
|
||||||
|
|
||||||
if (master_env[0] == '\0') /* some shells panic on empty master env. */
|
if (master_env[0] == '\0') /* some shells panic on empty master env. */
|
||||||
fmemcpy(master_env, "PATH=.\0\0", sizeof("PATH=.\0\0"));
|
fmemcpy(master_env, "PATH=.\0\0\0\0", sizeof("PATH=.\0\0\0\0"));
|
||||||
|
|
||||||
/* process 0 */
|
/* process 0 */
|
||||||
/* Execute command.com from the drive we just booted from */
|
/* Execute command.com from the drive we just booted from */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user