Module Name: src Committed By: kre Date: Fri Jul 12 07:30:30 UTC 2024
Modified Files: src/bin/sh: exec.c exec.h histedit.c myhistedit.h options.c options.h var.c var.h Log Message: Improve safety in var imports from the environment. Add a new var flag VUNSAFE - set on all vars imported from the environment. Add setvareqsafe() (which is to setvareq() as setvarsafe() is to setvar()) and use that instead of setvareq() when processing the environment, so errors don't cause the shell to abort. Use VUNSAFE in that call. Add flags arguments to all var callback functions which are used when setting variables, and pass the flags given to the setvar*() functions to those functions, so they can act differently in different situations (if desired). Most of them just ignore the flags. When unsetting a variable, call setvar() to clear things (and call the callback function) both when the variable had a value which needs to be freed, and when unsetting a variable which wasn't unset previously, so the VUNSET flag can be seen by that callback func. When setting HISTSIZE, use the flags passed to determine whether to ignore bad values (if VUNSAFE) or treat them as an error. This replaces the earlier temporary hack to always ignore bad data there (histedit.c 1.68). Miscellaneous associated minor changes. These changes should largely be invisible in normal use. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/bin/sh/exec.c src/bin/sh/options.c cvs rdiff -u -r1.27 -r1.28 src/bin/sh/exec.h src/bin/sh/options.h cvs rdiff -u -r1.69 -r1.70 src/bin/sh/histedit.c cvs rdiff -u -r1.14 -r1.15 src/bin/sh/myhistedit.h cvs rdiff -u -r1.82 -r1.83 src/bin/sh/var.c cvs rdiff -u -r1.39 -r1.40 src/bin/sh/var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.