do not crash when browsing through history containing comment (#733813)

This commit is contained in:
Michal Hlavinka 2011-12-07 16:02:42 +01:00
parent 6acaf4cd5e
commit 51febfd963
2 changed files with 28 additions and 1 deletions

View File

@ -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);
}

View File

@ -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@redhat.com> - 20110630-9
- do not crash when browsing through history containing comment (#733813)
* Wed Dec 07 2011 Michal Hlavinka <mhlavink@redhat.com> - 20110630-8
- do not crash when two subseguent dots are used in variable or command name (#733544)