about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-11-25 18:39:04 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-11-25 18:39:04 +0000
commitfed941ce242496d1cffe8955a8842f37063bcf7e (patch)
treefeea23ce788412ab25e2c5cdd8e8998f69e55da8
parent21e1b38ffb47911c6c076a0d5bdc4f726b566b38 (diff)
downloadzsh-fed941ce242496d1cffe8955a8842f37063bcf7e.tar.gz
zsh-fed941ce242496d1cffe8955a8842f37063bcf7e.tar.xz
zsh-fed941ce242496d1cffe8955a8842f37063bcf7e.zip
26091: crash at end of history line if history not in use
-rw-r--r--ChangeLog5
-rw-r--r--Src/hist.c14
2 files changed, 13 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index ea85adeae..b658f0410 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-25  Peter Stephenson  <pws@csr.com>
+
+	* 26091: Src/hist.c: crash at end of history line if history
+	not in use.
+
 2008-11-24  Peter Stephenson  <pws@csr.com>
 
 	* Frank Terbeck: users/13482: Doc/Zsh/contrib.yo: fix some prompt
diff --git a/Src/hist.c b/Src/hist.c
index 65812dc91..838c06993 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1130,12 +1130,14 @@ hend(Eprog prog)
      && (hist_ignore_all_dups = isset(HISTIGNOREALLDUPS)) != 0)
 	histremovedups();
 
-    /*
-     * Added the following in case the test "hptr < chline + 1"
-     * is more than just paranoia.
-     */
-    DPUTS(hptr < chline, "History end pointer off start of line");
-    *hptr = '\0';
+    if (hptr) {
+	/*
+	 * Added the following in case the test "hptr < chline + 1"
+	 * is more than just paranoia.
+	 */
+	DPUTS(hptr < chline, "History end pointer off start of line");
+	*hptr = '\0';
+    }
     addlinknode(hookargs, "zshaddhistory");
     addlinknode(hookargs, chline);
     callhookfunc("zshaddhistory", hookargs, 1, &hookret);