From 973f23b1df27720e29784da080823e3366a8bebf Mon Sep 17 00:00:00 2001 From: Nikita Bloshchanevich Date: Sun, 7 Mar 2021 18:18:50 +0100 Subject: [PATCH] `git-commit': fix variable predicates `git-commit-summary-max-length' should be a number, not a symbol. `git-commit-major-mode' should be checked more carefully, as otherwise exploits are possible (e.g. if it is `erase-buffer' or some more dangerous function of the user's environment). --- modules/emacs/vc/config.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/emacs/vc/config.el b/modules/emacs/vc/config.el index 6cfd1de00..64ba695cf 100644 --- a/modules/emacs/vc/config.el +++ b/modules/emacs/vc/config.el @@ -9,8 +9,11 @@ (setenv "GIT_ASKPASS" "git-gui--askpass")) ;; Don't complain when these variables are set in file/local vars -(put 'git-commit-major-mode 'safe-local-variable 'symbolp) -(put 'git-commit-summary-max-length 'safe-local-variable 'symbolp) +(put 'git-commit-major-mode 'safe-local-variable + (lambda (x) + (memq x '(git-commit-elisp-text-mode + text-mode fundamental-mode org-mode markdown-mode)))) +(put 'git-commit-summary-max-length 'safe-local-variable 'numberp) ;; In case the user is using `bug-reference-mode' (map! :when (fboundp 'bug-reference-mode)