about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_refresh.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 172136b39..5c5e49aad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-29  Peter Stephenson  <pws@csr.com>
+
+	* 24893: Src/Zle/zle_refresh.c: duplicate statusline to avoid
+	crashes when it's passed from a constant string.
+
 2008-04-28  Peter Stephenson  <pws@csr.com>
 
 	* unposted: Src/Zle/zle_hist.c: when anchoring a pattern
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index cc0dbe4c0..798541646 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1418,8 +1418,9 @@ zrefresh(void)
 
     if (statusline) {
 	int outll, outsz;
+	char *statusdup = ztrdup(statusline);
 	ZLE_STRING_T outputline =
-	    stringaszleline(statusline, 0, &outll, &outsz, NULL); 
+	    stringaszleline(statusdup, 0, &outll, &outsz, NULL); 
 
 	rpms.tosln = rpms.ln + 1;
 	nbuf[rpms.ln][winw + 1] = zr_zr;	/* text not wrapped */
@@ -1484,6 +1485,7 @@ zrefresh(void)
 	    snextline(&rpms);
 	}
 	zfree(outputline, outsz);
+	free(statusdup);
     }
     *rpms.s = zr_zr;