1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

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
This commit is contained in:
Junya Takahashi 2021-04-12 10:14:11 +02:00 committed by Lars Ingebrigtsen
parent 104c5e3d57
commit 636e9fd6a0

View File

@ -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