diff options
author | Junya Takahashi <jutakat@gmail.com> | 2021-04-12 10:14:11 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-04-12 10:14:48 +0200 |
commit | 636e9fd6a0c6b7801fd5a0d58fd42c93aab7332d (patch) | |
tree | b4ebc0eb676cdb9c17a525f064a76b9b547a323b /lisp/epa-file.el | |
parent | 104c5e3d57705cd4bd291b61d7f165def602ab5c (diff) | |
download | emacs-636e9fd6a0c6b7801fd5a0d58fd42c93aab7332d.tar.gz emacs-636e9fd6a0c6b7801fd5a0d58fd42c93aab7332d.tar.bz2 emacs-636e9fd6a0c6b7801fd5a0d58fd42c93aab7332d.zip |
Fix args-out-of-range error in epa-file-insert-file-contents
* lisp/epa-file.el (epa-file-insert-file-contents): Don't bug out
on a region that's longer than the file (bug#47718).
Copyright-paperwork-exempt: yes
Diffstat (limited to 'lisp/epa-file.el')
-rw-r--r-- | lisp/epa-file.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/epa-file.el b/lisp/epa-file.el index e46e3684c8a..33bf5adabe6 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -198,7 +198,9 @@ encryption is used." (mapcar #'car (epg-context-result-for context 'encrypted-to))) (if (or beg end) - (setq string (substring string (or beg 0) end))) + (setq string (substring string + (or beg 0) + (and end (min end (length string)))))) (save-excursion ;; If visiting, bind off buffer-file-name so that ;; file-locking will not ask whether we should |