summaryrefslogtreecommitdiff
path: root/system/pdksh/patches/044_Debian-emacs-crash.patch
blob: 047302811bf966c3581309107adbfb1350db9c54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  * emacs.c: Fix segmentation fault bug when ksh used bash history file
    (closes: #284358).
Index: pdksh-5.2.14/emacs.c
===================================================================
--- pdksh-5.2.14.orig/emacs.c	2008-04-15 20:49:47.000000000 +0200
+++ pdksh-5.2.14/emacs.c	2008-04-15 20:53:50.000000000 +0200
@@ -883,9 +883,9 @@
 	}
 	x_histp = hp;
 	oldsize = x_size_str(xbuf);
-	(void)strcpy(xbuf, *hp);
+	(void)strncpy(xbuf, *hp, xend - xbuf - 1);
 	xbp = xbuf;
-	xep = xcp = xbuf + strlen(*hp);
+	xep = xcp = xbuf + strlen(xbuf);
 	xlp_valid = FALSE;
 	if (xep > x_lastcp())
 	  x_goto(xep);