From 88a6cb6f8e27d80ac818b4d827063a8c9c6822d7 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 25 May 2020 10:44:23 +0530 Subject: 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. --- email/email.scm | 13 +++---------- 1 file 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 +;;; Copyright © 2018, 2019, 2020 Arun Isaac ;;; ;;; 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) -- cgit v1.2.3