Resolves: #1222867 - fix SIGSEGV of the syntax check in ksh emulation mode

This commit is contained in:
Kamil Dudka 2015-05-22 14:48:51 +02:00
parent 53bf4e6df6
commit 724b3efd39
2 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From 3427fe59c2d76ddbf4b23908c6ae5272734c7c8b Mon Sep 17 00:00:00 2001
From: "Barton E. Schaefer" <schaefer@zsh.org>
Date: Wed, 20 May 2015 10:14:04 -0700
Subject: [PATCH] 35231: make mkevnstr() safe for NULL value
Upstream-commit: af957f2ed6287f66953742fbca69188cecb98fbf
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Src/params.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/Src/params.c b/Src/params.c
index 61edc5d..d0ce0a9 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -4534,17 +4534,21 @@ addenv(Param pm, char *value)
static char *
mkenvstr(char *name, char *value, int flags)
{
- char *str, *s;
- int len_name, len_value;
+ char *str, *s = value;
+ int len_name, len_value = 0;
len_name = strlen(name);
- for (len_value = 0, s = value;
- *s && (*s++ != Meta || *s++ != 32); len_value++);
+ if (s)
+ while (*s && (*s++ != Meta || *s++ != 32))
+ len_value++;
s = str = (char *) zalloc(len_name + len_value + 2);
strcpy(s, name);
s += len_name;
*s = '=';
- copyenvstr(s, value, flags);
+ if (value)
+ copyenvstr(s, value, flags);
+ else
+ *++s = '\0';
return str;
}
--
2.4.1

View File

@ -3,7 +3,7 @@
Summary: Powerful interactive shell Summary: Powerful interactive shell
Name: zsh Name: zsh
Version: 5.0.7 Version: 5.0.7
Release: 7%{?dist} Release: 8%{?dist}
License: MIT License: MIT
URL: http://zsh.sourceforge.net/ URL: http://zsh.sourceforge.net/
Group: System Environment/Shells Group: System Environment/Shells
@ -38,6 +38,9 @@ Patch10: zsh-5.0.7-signal-safety.patch
# improve signal name generation (prevents Test/C03traps.ztst from failing) # improve signal name generation (prevents Test/C03traps.ztst from failing)
Patch11: zsh-5.0.7-signal-name.patch Patch11: zsh-5.0.7-signal-name.patch
# fix SIGSEGV of the syntax check in ksh emulation mode (#1222867)
Patch12: zsh-5.0.7-ksh-syntax-check.patch
BuildRequires: coreutils sed ncurses-devel libcap-devel BuildRequires: coreutils sed ncurses-devel libcap-devel
BuildRequires: texinfo texi2html gawk hostname BuildRequires: texinfo texi2html gawk hostname
Requires(post): info grep Requires(post): info grep
@ -80,6 +83,7 @@ This package contains the Zsh manual in html format.
%patch9 -p1 %patch9 -p1
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
%patch12 -p1
cp -p %SOURCE7 . cp -p %SOURCE7 .
@ -197,6 +201,9 @@ fi
%doc Doc/*.html %doc Doc/*.html
%changelog %changelog
* Fri May 22 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.7-8
- fix SIGSEGV of the syntax check in ksh emulation mode (#1222867)
* Mon Apr 20 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.7-7 * Mon Apr 20 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.7-7
- fix SIGSEGV when handling heredocs and keyboard interrupt (#972624) - fix SIGSEGV when handling heredocs and keyboard interrupt (#972624)
- queue signals when manipulating global state to avoid deadlock - queue signals when manipulating global state to avoid deadlock