editors/emacs: Backport Emacs 29.4 security fix
Details about the security vulnerability can be found at
https://seclists.org/oss-sec/2024/q2/296.
Reviewed by: ashish
Sponsored by: The FreeBSD Foundation
Security: https://vuxml.freebsd.org/freebsd/4f6c4c07-3179-11ef-9da5-1c697a616631.html
Differential Revision: https://reviews.freebsd.org/D45714
(cherry picked from commit 8ef91da50b7381a2f0f014ed3c7ee247269482a2)