-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
The previous commit exposed a bug in libcmd's getconf(1) built-in command. First, note that the 'builtin' built-in command can bind a libcmd built-in command to any path: for example, 'builtin /foo/bar/getconf' works. As of 519bb08, path-bound built-ins can be invoked using their canonical path, not just the command name, so invoking a command by its path no longer guarantees that an external command is run. Consequently, if the built-in is bound to the same path that conf.sh detected for the external command, there is an infinite recursion ending in a C stack overflow: b_getconf() in src/lib/libcmd/getconf.c keeps invoking itself via sh_run(). src/lib/libcmd/getconf.c: - b_getconf(): Use 'command -x' to invoke the fallback getconf command to guarantee that no path-bound built-in is run. src/lib/libast/port/astconf.c: - Fix another bug found in lookup() while I was tracing the above one with ASan: an off-by-one error caused a out-of-bounds access just beyond the conf array when looking up certain names. The last element is lo + conf_elements - 1, not lo + conf_elements. - Also fix the confusing way in which these variables are declared.
- Loading branch information
Showing
5 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters