From: Lars Ingebrigtsen Date: Thu, 28 Jan 2021 12:10:45 +0000 (+0100) Subject: Protect against bad results from libravatar X-Git-Tag: emacs-28.0.90~4078 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0120f45db630753bc8c4d6c43f7cdb7f953144fd;p=emacs.git Protect against bad results from libravatar * lisp/image/gravatar.el (gravatar--service-libravatar): Don't have (gravatar-retrieve "foobar@zjp.codes" 'ignore) (which returns a CNAME) bug out. --- diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el index 4f37834a27f..b1e2a314ce8 100644 --- a/lisp/image/gravatar.el +++ b/lisp/image/gravatar.el @@ -160,12 +160,16 @@ to track whether you're reading a specific mail." (cond ((and result ;there is a result - (let* ((data (mapcar (lambda (record) + (let* ((answers (dns-get 'answers result)) + (data (mapcar (lambda (record) (dns-get 'data (cdr record))) - (dns-get 'answers result))) - (priorities (mapcar (lambda (r) - (dns-get 'priority r)) - data)) + ;; We may get junk data back (or CNAME; + ;; ignore). + (and (eq (dns-get 'type answers) 'SRV) + answers))) + (priorities (and (mapcar (lambda (r) + (dns-get 'priority r)) + data))) (max-priority (if priorities (apply #'max priorities) 0))