zsh/74eed99c312de05e19b54ba6b5d37a0aeb4ba713.patch
Ismail Dönmez d4737238b5 - Fix license to be MIT, zsh seems to be using the "Modern" variant
of the license text.
- Import git commits 74eed99c312de05e19b54ba6b5d37a0aeb4ba713 and
  724fd07a67f135c74eba57e9f25fd342201ec722
  * metafy() added null termination even if buffer was not modifiable
  * Fix uninitialised memory after lexer realloc

OBS-URL: https://build.opensuse.org/package/show/shells/zsh?expand=0&rev=87
2011-12-05 09:43:11 +00:00

30 lines
776 B
Diff

commit 74eed99c312de05e19b54ba6b5d37a0aeb4ba713
Author: Peter Stephenson <pws@users.sourceforge.net>
Date: Sat Dec 3 23:15:37 2011 +0000
29940: metafy() added null termination even if buffer was not modifiable
diff --git a/Src/utils.c b/Src/utils.c
index 6c2ea98..014cb2f 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -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;
}