[ksh] do not crash when browsing through history containing comment (#733813)
Michal Hlavinka
mhlavink at fedoraproject.org
Wed Dec 7 15:02:50 UTC 2011
commit 51febfd9638dac12765c8359a9b3bbf301170c57
Author: Michal Hlavinka <mhlavink at redhat.com>
Date: Wed Dec 7 16:02:42 2011 +0100
do not crash when browsing through history containing comment (#733813)
ksh-20110630-histfix.patch | 21 +++++++++++++++++++++
ksh.spec | 8 +++++++-
2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/ksh-20110630-histfix.patch b/ksh-20110630-histfix.patch
new file mode 100644
index 0000000..6d08682
--- /dev/null
+++ b/ksh-20110630-histfix.patch
@@ -0,0 +1,21 @@
+diff -up ksh-20110630/src/cmd/ksh93/edit/edit.c.histfix ksh-20110630/src/cmd/ksh93/edit/edit.c
+--- ksh-20110630/src/cmd/ksh93/edit/edit.c.histfix 2011-03-03 16:20:03.000000000 +0100
++++ ksh-20110630/src/cmd/ksh93/edit/edit.c 2011-12-07 15:55:50.576089698 +0100
+@@ -1655,7 +1655,7 @@ int ed_histgen(Edit_t *ep,const char *pa
+ History_t *hp;
+ off_t offset;
+ int ac=0,l,m,n,index1,index2;
+- char *cp, **argv, **av, **ar;
++ char *cp, **argv=NULL, **av, **ar;
+ if(!(hp=ep->sh->gd->hist_ptr))
+ return(0);
+ if(*pattern=='#')
+@@ -1734,7 +1734,7 @@ int ed_histgen(Edit_t *ep,const char *pa
+ mplast->next = 0;
+ }
+ ep->hlist = (Histmatch_t**)argv;
+- ep->hfirst = ep->hlist[0];
++ ep->hfirst = ep->hlist ? ep->hlist[0] : NULL;
+ return(ep->hmax=ac);
+ }
+
diff --git a/ksh.spec b/ksh.spec
index 0fdba52..1837580 100644
--- a/ksh.spec
+++ b/ksh.spec
@@ -6,7 +6,7 @@ URL: http://www.kornshell.com/
Group: System Environment/Shells
License: CPL
Version: 20110630
-Release: 8%{?dist}
+Release: 9%{?dist}
Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{releasedate}.tgz
Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{releasedate}.tgz
Source3: kshrc.rhs
@@ -34,6 +34,8 @@ Patch7: ksh-20110630-dontstop.patch
Patch8: ksh-20110630-ddotfix.patch
+Patch9: ksh-20110630-histfix.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Conflicts: pdksh
Requires: coreutils, glibc-common, diffutils
@@ -60,6 +62,7 @@ with "sh" (the Bourne Shell).
%patch6 -p1 -b .joblimit
%patch7 -p1 -b .dontstop
%patch8 -p1 -b .ddotfix
+%patch9 -p1 -b .histfix
#/dev/fd test does not work because of mock
sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options
@@ -145,6 +148,9 @@ fi
rm -rf $RPM_BUILD_ROOT
%changelog
+* Wed Dec 07 2011 Michal Hlavinka <mhlavink at redhat.com> - 20110630-9
+- do not crash when browsing through history containing comment (#733813)
+
* Wed Dec 07 2011 Michal Hlavinka <mhlavink at redhat.com> - 20110630-8
- do not crash when two subseguent dots are used in variable or command name (#733544)
More information about the scm-commits
mailing list