From d76cb457bf816f506b1b12e56fa709d56644082c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 28 Nov 2013 16:12:40 +0100 Subject: util.pposix: Verify that file handle is open --- util-src/pposix.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util-src') diff --git a/util-src/pposix.c b/util-src/pposix.c index 7f64038b..4fb1fb56 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -666,6 +666,8 @@ int lc_fallocate(lua_State* L) { off_t offset, len; FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE); + if (f == NULL) + luaL_error(L, "attempt to use a closed file"); offset = luaL_checkinteger(L, 2); len = luaL_checkinteger(L, 3); -- cgit v1.2.3