diff src/memline.c @ 3839:8115f449a574 v7.3.677

updated for version 7.3.677 Problem: buf_spname() is used inconsistently. Solution: Make the return type a char_u pointer. Check the size of the returned string.
author Bram Moolenaar <bram@vim.org>
date Wed, 03 Oct 2012 18:25:00 +0200
parents 075acc2dccaa
children 04736b4030ec
line wrap: on
line diff
--- a/src/memline.c
+++ b/src/memline.c
@@ -780,9 +780,7 @@ ml_open_file(buf)
 	need_wait_return = TRUE;	/* call wait_return later */
 	++no_wait_return;
 	(void)EMSG2(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
-		    buf_spname(buf) != NULL
-			? (char_u *)buf_spname(buf)
-			: buf->b_fname);
+		    buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
 	--no_wait_return;
     }
 
@@ -1315,7 +1313,7 @@ ml_recover()
     smsg((char_u *)_("Using swap file \"%s\""), NameBuff);
 
     if (buf_spname(curbuf) != NULL)
-	STRCPY(NameBuff, buf_spname(curbuf));
+	vim_strncpy(NameBuff, buf_spname(curbuf), MAXPATHL - 1);
     else
 	home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE);
     smsg((char_u *)_("Original file \"%s\""), NameBuff);