diff --git a/.gitattributes b/.gitattributes
index cf1989e08ac48d7ea4a90575cfe7014a24b6c705..03f5a2deb4db7063cc1ec0387cd3041aa8360a72 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -690,7 +690,6 @@ testfont binary
 /src/modules/files/acconfig.h foreign_ident
 /src/modules/files/configure.in foreign_ident
 /src/modules/files/datagram.c foreign_ident
-/src/modules/files/efuns.c foreign_ident
 /src/modules/files/file.c foreign_ident
 /src/modules/files/file.h foreign_ident
 /src/modules/files/file_functions.h foreign_ident
diff --git a/src/modules/files/efuns.c b/src/modules/files/efuns.c
index a34c8a50e33af25d74d6b30b25d8d1a953a855ce..c69b5d52459fc4846665221fc1b8693f382e1985 100644
--- a/src/modules/files/efuns.c
+++ b/src/modules/files/efuns.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: efuns.c,v 1.154 2004/11/20 16:19:30 nilsson Exp $
+|| $Id$
 */
 
 #include "global.h"
@@ -1312,7 +1312,8 @@ void f_mv(INT32 args)
   }
 
   else {
-    char *s = malloc (str2->len + 2), *p;
+    /* NB: 3 == 2 bytes temporary suffix and 1 byte NUL-terminator. */
+    char *s = malloc (str2->len + 3), *p;
     if (!s) {
       i = movefileex ? ERROR_NOT_ENOUGH_MEMORY : ENOMEM;
       goto no_nt_rename_kludge;