From d4737238b561306880b4e267a64c0bc7a1f16d9bcd1ecf59114538260906768d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Mon, 5 Dec 2011 09:43:11 +0000 Subject: [PATCH] - 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 --- ...d07a67f135c74eba57e9f25fd342201ec722.patch | 35 +++++++++++++++++++ ...d99c312de05e19b54ba6b5d37a0aeb4ba713.patch | 29 +++++++++++++++ zsh.changes | 11 ++++++ zsh.spec | 7 +++- 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 724fd07a67f135c74eba57e9f25fd342201ec722.patch create mode 100644 74eed99c312de05e19b54ba6b5d37a0aeb4ba713.patch diff --git a/724fd07a67f135c74eba57e9f25fd342201ec722.patch b/724fd07a67f135c74eba57e9f25fd342201ec722.patch new file mode 100644 index 0000000..9de6dae --- /dev/null +++ b/724fd07a67f135c74eba57e9f25fd342201ec722.patch @@ -0,0 +1,35 @@ +commit 724fd07a67f135c74eba57e9f25fd342201ec722 +Author: Peter Stephenson +Date: Sat Dec 3 17:24:45 2011 +0000 + + 29934: Stef van Vlierberghe: uninitialised memory after lexer realloc + +diff --git a/Src/lex.c b/Src/lex.c +index 90c4eff..05f54f8 100644 +--- a/Src/lex.c ++++ b/Src/lex.c +@@ -567,22 +567,14 @@ add(int c) + { + *bptr++ = c; + if (bsiz == ++len) { +-#if 0 +- int newbsiz; +- +- newbsiz = bsiz * 8; +- while (newbsiz < inbufct) +- newbsiz *= 2; +- bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz)); +- bsiz = newbsiz; +-#endif +- + int newbsiz = bsiz * 2; + + if (newbsiz > inbufct && inbufct > bsiz) + newbsiz = inbufct; + + bptr = len + (tokstr = (char *)hrealloc(tokstr, bsiz, newbsiz)); ++ /* len == bsiz, so bptr is at the start of newly allocated memory */ ++ memset(bptr, 0, newbsiz - bsiz); + bsiz = newbsiz; + } + } diff --git a/74eed99c312de05e19b54ba6b5d37a0aeb4ba713.patch b/74eed99c312de05e19b54ba6b5d37a0aeb4ba713.patch new file mode 100644 index 0000000..a1627fd --- /dev/null +++ b/74eed99c312de05e19b54ba6b5d37a0aeb4ba713.patch @@ -0,0 +1,29 @@ +commit 74eed99c312de05e19b54ba6b5d37a0aeb4ba713 +Author: Peter Stephenson +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; + } + diff --git a/zsh.changes b/zsh.changes index 3fa7949..e508c49 100644 --- a/zsh.changes +++ b/zsh.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Dec 5 09:40:23 UTC 2011 - idoenmez@suse.de + +- 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 + ------------------------------------------------------------------- Wed Nov 30 21:49:26 UTC 2011 - idoenmez@suse.de diff --git a/zsh.spec b/zsh.spec index e25ba28..2f57ef6 100644 --- a/zsh.spec +++ b/zsh.spec @@ -20,7 +20,7 @@ Name: zsh Version: 4.3.13 Release: 4 -License: BSD +License: MIT Summary: Shell with comprehensive completion Url: http://www.zsh.org %if 0%{?suse_version} @@ -42,6 +42,9 @@ Source16: dotzshrc.rh Source17: zshprompt.pl %endif Patch1: %{name}-4.3.12-disable-c02cond-test.patch +# Fixes from zsh.git +Patch100: 724fd07a67f135c74eba57e9f25fd342201ec722.patch +Patch101: 74eed99c312de05e19b54ba6b5d37a0aeb4ba713.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} Requires(pre): %{install_info_prereq} @@ -96,6 +99,8 @@ This package contains the Zsh manual in html format. %prep %setup -q -n %{name}-%{version} %patch1 +%patch100 -p1 +%patch101 -p1 # Remove executable bit chmod 0644 Etc/changelog2html.pl