diff --git a/ChangeLog b/ChangeLog
index 33213f2851854411f652b1c1a6d101087b1f14e9..87faafe69a1ebb2c8b3e84b9e0c489bbc4a38b91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 	* src/browser.c (do_browser, browser_refresh): Rebuild the file list
 	only when necessary, not for each and every cursor movement.  This
 	fixes Savannah bug #47133.
+	* src/files.c (save_poshistory): Allocate enough space for printing
+	out the line and column numbers.  This fixes Savannah bug #47135.
 
 GNU nano 2.5.2 - 2016.02.12
 
diff --git a/src/files.c b/src/files.c
index c16b9272fe830d2e532af62a870c0f95fafecde4..400f2a60e06e739adaf7ea79d227eec54d4f6497 100644
--- a/src/files.c
+++ b/src/files.c
@@ -3177,7 +3177,9 @@ void save_poshistory(void)
 	chmod(poshist, S_IRUSR | S_IWUSR);
 
 	for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
-	    statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
+	    /* Assume 20 decimal positions each for line and column number,
+	     * plus two spaces, plus the line feed, plus the null byte. */
+	    statusstr = charalloc(strlen(posptr->filename) + 44);
 	    sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
 			(long)posptr->xno);
 	    if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))