Fix PKCS7_verify to not have an error stack if it succeeds.
[openssl.git] / crypto / bio / bio_lib.c
index 91db2290c4e4b8b87e50930790e12e1a3730913d..80b81db5c400563280dd360cc43ad7b43b292ab7 100644 (file)
@@ -334,10 +334,13 @@ static int bio_write_intern(BIO *b, const void *data, size_t dlen,
 {
     int ret;
 
-    if (b == NULL) {
-        ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER);
-        return -1;
-    }
+    /*
+     * b == NULL is not an error but just means that zero bytes are written.
+     * Do not raise an error here.
+     */
+    if (b == NULL)
+        return 0;
+
     if (b->method == NULL || b->method->bwrite == NULL) {
         ERR_raise(ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD);
         return -2;