diff -upk.orig postfix-2.2.4.orig/src/local/dotforward.c postfix-2.2.4/src/local/dotforward.c --- postfix-2.2.4.orig/src/local/dotforward.c 2002-11-16 19:59:39 +0000 +++ postfix-2.2.4/src/local/dotforward.c 2005-02-26 22:49:30 +0000 @@ -235,6 +235,17 @@ int deliver_dotforward(LOCAL_STATE s msg_warn("file %s is world writable", STR(path)); } else if ((fd = open_as(STR(path), O_RDONLY, 0, usr_attr.uid, usr_attr.gid)) < 0) { msg_warn("cannot open file %s: %m", STR(path)); + } else if (fstat(fd, &st) != 0) { + msg_warn("cannot fstat file %s: %m", STR(path)); + close(fd); + } else if (S_ISREG(st.st_mode) == 0) { + msg_warn("file %s is no longer a regular file", STR(path)); + close(fd); + } else if (st.st_size > st.st_blocks * st.st_blksize && + st.st_blksize >= 512) { + /* This works on Linux with ext2fs, but it doesn't have to */ + msg_warn("file %s is a sparse file", STR(path)); + close(fd); } else { close_on_exec(fd, CLOSE_ON_EXEC); addr_count = 0;