diff --git a/runtime/lua/nvim/zip.lua b/runtime/lua/nvim/zip.lua index c1f12689d7..47f7da80ec 100644 --- a/runtime/lua/nvim/zip.lua +++ b/runtime/lua/nvim/zip.lua @@ -10,6 +10,11 @@ local function unzip() if command == '' then return nil, 'unzip executable not found' end + -- Windows searches the current directory before $PATH, so an archive could be opened with an + -- `unzip` shipped next to it. + if vim.fs.dirname(vim.fs.normalize(command)) == vim.fs.normalize(vim.fn.getcwd()) then + return nil, 'refusing to run unzip from the current directory' + end return command end