Skip to content

Commit

Permalink
SetEnv: disallow '=' in envvar
Browse files Browse the repository at this point in the history
Don't allow '=' in the envvar as this breaks most/all shells.

From somiaj.
  • Loading branch information
ThomasAdam committed Nov 27, 2024
1 parent 07f625e commit 9a0b764
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fvwm/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -3333,13 +3333,20 @@ void CMD_SetEnv(F_CMD_ARGS)
{
return;
}

if (strchr(szVar, '=') != NULL) {
fvwm_debug(__func__, "Invalid envvar: %s", szVar);
goto out;
}

action = GetNextToken(action, &szValue);
if (!szValue)
{
szValue = fxstrdup("");
}
xasprintf(&szPutenv, "%s=%s", szVar, szValue);
flib_putenv(szVar, szPutenv);
out:
free(szVar);
free(szPutenv);
free(szValue);
Expand Down

0 comments on commit 9a0b764

Please sign in to comment.