SMIME_crlf_copy(): check for NULL pointer arguments
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Thu, 25 May 2023 15:48:04 +0000 (17:48 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Thu, 1 Jun 2023 07:56:20 +0000 (09:56 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/21058)

crypto/asn1/asn_mime.c

index 898c204fbc9be74ba28b1a3da7dda964f91003c6..b228b29ed7d1421e0b5f4fe61bc336e19fbbd278 100644 (file)
@@ -516,6 +516,12 @@ int SMIME_crlf_copy(BIO *in, BIO *out, int flags)
     int len;
     char linebuf[MAX_SMLEN];
     int ret;
+
+    if (in == NULL || out == NULL) {
+        ERR_raise(ERR_LIB_ASN1, ERR_R_PASSED_NULL_PARAMETER);
+        return 0;
+    }
+
     /*
      * Buffer output so we don't write one line at a time. This is useful
      * when streaming as we don't end up with one OCTET STRING per line.