diff --git a/ChangeLog b/ChangeLog
index 2602182971603390f4de651ef8905b996e475119..d97d62a12ca8bf872b5c996364ad478f6c536536 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@ CVS code -
 	   replaces cuttingpartialline).
   do_uncut_text()
 	- Similar display fixes (David Lawrence Ramsey).
+  cut_marked_segment()
+	- Fix off-by one in mem allocation.
 - faq.html
 	- Removed nano-editor.org FTP site address [deprecated] and added
 	the GNU one.
diff --git a/cut.c b/cut.c
index aab6d44ff6b2ab53eb0caaddd272db8aca6f67a1..5bc80f122ccb80ef11de2cb29f3e3b58bdacef6c 100644
--- a/cut.c
+++ b/cut.c
@@ -141,7 +141,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
     /* Now, paste bot[bot_x] into top[top_x] */
     if (destructive) {
 
-	tmpstr = charalloc(strlen(top->data) + strlen(&bot->data[bot_x]));
+	tmpstr = charalloc(top_x + strlen(&bot->data[bot_x]) + 1);
 	strncpy(tmpstr, top->data, top_x);
 	strcpy(&tmpstr[top_x], &bot->data[bot_x]);
 	free(top->data);