-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent improper files (like /dev/random) from being used as file arguments #10733
base: master
Are you sure you want to change the base?
Conversation
I don't think the arg parsing is the right place to do this. We should fundamentally disallow opening non-files so it's consistent with :open/:vsplit and any other way a user would open a path |
That is a good point, I'll see if I can get this to work in a more interoperable way and will amend the PR |
This reverts commit c123944.
By making changes to the Document::open method I have the :open command working as expected, however when I revert the prior changes to argument parsing the application errors out ungracefully:
In this case, maybe it would be better to keep both checks so that the application does not crash when it gets an invalid input? |
You probably need to handle that error and just create an empty scratch buffer if the file can't open. |
done, thank you all for the suggestions and advice! |
As per the suggestions in #10726 this pull request changes the argument parsing to only add a PathBuf to args.files if it is either a file or a symlink. This has been tested on the scenarios provided in the issue and simply opens an empty buffer as if no argument was provided in those cases. (instead of freezing)