mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-19 23:41:31 +01:00
29940: metafy() added null termination even if buffer was not modifiable
This commit is contained in:
parent
724fd07a67
commit
74eed99c31
2 changed files with 6 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
|||
2011-12-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 29940: Src/utils.c (metafy): null termination shouldn't
|
||||
be applied to original buffer if not to be modified.
|
||||
|
||||
* From Stef VAN VLIERBERGHE: 29934: Src/lex.c (add): use of
|
||||
uninitialised memoryx when lexer needed to reallocate token.
|
||||
|
||||
|
@ -15650,5 +15653,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5514 $
|
||||
* $Revision: 1.5515 $
|
||||
*****************************************************
|
||||
|
|
|
@ -3959,7 +3959,7 @@ metafy(char *buf, int len, int heap)
|
|||
if (imeta(*e++))
|
||||
meta++;
|
||||
|
||||
if (meta || heap == META_DUP || heap == META_HEAPDUP) {
|
||||
if (meta || heap == META_DUP || heap == META_HEAPDUP || *e != '\0') {
|
||||
switch (heap) {
|
||||
case META_REALLOC:
|
||||
buf = zrealloc(buf, len + meta + 1);
|
||||
|
@ -4002,8 +4002,8 @@ metafy(char *buf, int len, int heap)
|
|||
meta--;
|
||||
}
|
||||
}
|
||||
*e = '\0';
|
||||
}
|
||||
*e = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue