1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 15:01:21 +02:00

22578: ensure HISTCHARS/histchars never contains non-ASCII characters

This commit is contained in:
Peter Stephenson 2006-08-02 17:16:37 +00:00
parent 21c83849a9
commit 6d61a3859e
4 changed files with 27 additions and 4 deletions

@ -1,5 +1,8 @@
2006-08-02 Peter Stephenson <pws@csr.com>
* 22578: README, Doc/Zsh/params.yo, Src/params.c: ensure
HISTCHARS/histchars never contains non-ASCII characters.
* unposted: Functions/Zle/history-beginning-search-menu,
Doc/Zsh/params.yo: yet more tweaks I'm too embarrassed to post:
^ also needs quoting; clear display on first non-digit character;

@ -803,6 +803,10 @@ mechanism. The first character signals the start of a history
expansion (default `tt(!)'). The second character signals the
start of a quick history substitution (default `tt(^)'). The third
character is the comment character (default `tt(#)').
The characters must be in the ASCII character set; any attempt to set
tt(histchars) to characters with a locale-dependent meaning will be
rejected with an error message.
)
vindex(HISTCHARS)
item(tt(HISTCHARS) <S> <Z>)(

5
README

@ -81,6 +81,11 @@ previous value was observed to be large enough that crashes still occurred
on some fairly common PC configurations. This change is only likely to
affect some highly specialised uses of the shell.
The variables HISTCHARS and histchars now reject any attempt to
set non-ASCII characters for history or comments. Multibyte characters
have never worked and the most consistent change was to restrict the
set to portable characters only.
Documentation
-------------

@ -3548,10 +3548,21 @@ void
histcharssetfn(UNUSED(Param pm), char *x)
{
if (x) {
bangchar = x[0];
hatchar = (bangchar) ? x[1] : '\0';
hashchar = (hatchar) ? x[2] : '\0';
zsfree(x);
int len, i;
unmetafy(x, &len);
if (len > 3)
len = 3;
for (i = 0; i < len; i++) {
if (!isascii(STOUC(x[i]))) {
zwarn("HISTCHARS can only contain ASCII characters");
return;
}
}
bangchar = len ? STOUC(x[0]) : '\0';
hatchar = len > 1 ? STOUC(x[1]) : '\0';
hashchar = len > 2 ? STOUC(x[2]) : '\0';
free(x);
} else {
bangchar = '!';
hashchar = '#';