diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index ff5bbe8f9642240f6501c2df447ca910795311e5..7a6de8921b77f5cd43a64aee8da0be2765df08c3 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: file.c,v 1.179 2000/07/17 22:54:25 hubbe Exp $");
+RCSID("$Id: file.c,v 1.180 2000/07/21 18:21:36 grubba Exp $");
 #include "fdlib.h"
 #include "interpret.h"
 #include "svalue.h"
@@ -1267,6 +1267,10 @@ static void file_open(INT32 args)
   {
      str=Pike_sp[-args].u.string;
 
+     if (strlen(str->str) != str->len) {
+       error("Filenames with NUL are not supported.\n");
+     }
+
 #ifdef PIKE_SECURITY
      if(!CHECK_SECURITY(SECURITY_BIT_SECURITY))
      {