Reject -pkg.el files with multi-line package descriptions

See https://github.com/boyw165/hl-anything/issues/2
This commit is contained in:
Steve Purcell 2014-11-08 13:57:33 +00:00
parent dc06d15eaf
commit e0c4c53284

View file

@ -708,14 +708,17 @@ Optionally PRETTY-PRINT the data."
(when (file-exists-p file-path) (when (file-exists-p file-path)
(let ((package-def (pb/read-from-file file-path))) (let ((package-def (pb/read-from-file file-path)))
(if (eq 'define-package (car package-def)) (if (eq 'define-package (car package-def))
(let ((pkgfile-info (cdr package-def))) (let* ((pkgfile-info (cdr package-def))
(descr (nth 2 pkgfile-info)))
(when (string-match "[\r\n]" descr)
(error "Illegal multi-line package description"))
(vector (vector
(nth 0 pkgfile-info) (nth 0 pkgfile-info)
(mapcar (mapcar
(lambda (elt) (lambda (elt)
(list (car elt) (version-to-list (cadr elt)))) (list (car elt) (version-to-list (cadr elt))))
(eval (nth 3 pkgfile-info))) (eval (nth 3 pkgfile-info)))
(nth 2 pkgfile-info) descr
(nth 1 pkgfile-info))) (nth 1 pkgfile-info)))
(error "No define-package found in %s" file-path))))) (error "No define-package found in %s" file-path)))))