-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{base,dir}name: add -z/--zero | arith: fix buffer overflow (#800)
src/cmd/ksh93/sh/arith.c: sh_mathstdfun(): - Fixed small buffer overflow: The check for null termination needs to happen after ensuring the name matches because the strncmp will return false if the name is shorter than fsize. - Remove a condition for breaking the loop that is never true; *tp->fname is a nonprintable byte that is never greater than c, which stores a printable character. See shtab_math in arch/*/src/cmd/ksh93/FEATURE/math. src/lib/libcmd/basename.c: - Added support for -z|--zero argument for compatiblity with GNU basename. - Implement the behavior described in the usage string regarding PATH_LEADING_SLASHES (which it had not supported at all). src/lib/libcmd/dirname.c: - Fix handling of initial // where 'getconf PATH_LEADING_SLASHES' is 1 (i.e. Cygwin). - Added support for -z|--zero argument for compatiblity with GNU basename. - Handle multiple operands. Co-authored-by: Martijn Dekker <martijn@inlv.org>
- Loading branch information
Showing
6 changed files
with
77 additions
and
26 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
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