aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2020-05-25 10:44:23 +0530
committerArun Isaac2020-05-25 19:58:55 +0530
commit88a6cb6f8e27d80ac818b4d827063a8c9c6822d7 (patch)
tree789a583c0946d98d3ac7acb0eb257e094febd195
parent02431261e07c3e069f14311e34faf2a5a7eefdd0 (diff)
downloadguile-email-88a6cb6f8e27d80ac818b4d827063a8c9c6822d7.tar.gz
guile-email-88a6cb6f8e27d80ac818b4d827063a8c9c6822d7.tar.lz
guile-email-88a6cb6f8e27d80ac818b4d827063a8c9c6822d7.zip
email: Do not filter base64 encoded bytes before decoding.
The new base64 decoder skips invalid characters safely. * email/email.scm (decode-body): Do not filter base64 encoded body to remove invalid base64 characters.
-rw-r--r--email/email.scm13
1 files changed, 3 insertions, 10 deletions
diff --git a/email/email.scm b/email/email.scm
index 9478477..928296d 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -1,5 +1,5 @@
;;; guile-email --- Guile email parser
-;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2018, 2019, 2020 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of guile-email.
;;;
@@ -886,15 +886,8 @@ list of header keys and values."
(define* (decode-body body encoding #:optional charset)
(let ((decoded-octets
(case encoding
- ((base64)
- (base64-decode
- (string-filter
- (char-set-union
- (ucs-range->char-set (char->integer #\a) (1+ (char->integer #\z)))
- (ucs-range->char-set (char->integer #\A) (1+ (char->integer #\Z)))
- (ucs-range->char-set (char->integer #\0) (1+ (char->integer #\9)))
- (char-set #\+ #\/ #\=))
- (bytevector->string body "us-ascii"))))
+ ((base64) (base64-decode
+ (bytevector->string body "us-ascii")))
((quoted-printable) (quoted-printable-decode
(bytevector->string body "us-ascii")))
((#{7bit}# #{8bit}# binary) body)