1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 13:01:28 +02:00

33894: boundary conditions in unmeta(), unmetafy()

Check that we aren't running off the end of the string when converting the
next byte after a Meta byte.  This is just defensive programming in case
of bad metafied strings coming through from gettokstr(), some repairs
there are likely still needed.
This commit is contained in:
Barton E. Schaefer 2014-12-07 11:06:07 -08:00
parent 9ddd022ff0
commit 48cd1b6c3b
2 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,7 @@
2014-12-07 Barton E. Schaefer <schaefer@zsh.org>
* 33894: Src/utils.c: boundary conditions in unmeta(), unmetafy()
2014-12-07 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Daniel Shahaf: 33883: Doc/Zsh/expn.yo,

View file

@ -4164,7 +4164,7 @@ unmetafy(char *s, int *len)
for (p = s; *p && *p != Meta; p++);
for (t = p; (*t = *p++);)
if (*t++ == Meta)
if (*t++ == Meta && *p)
t[-1] = *p++ ^ 32;
if (len)
*len = t - s;
@ -4208,8 +4208,10 @@ unmeta(const char *file_name)
meta = 0;
for (t = file_name; *t; t++) {
if (*t == Meta)
meta = 1;
if (*t == Meta) {
meta = t[1];
break;
}
}
if (!meta) {
/*