@@ -2600,11 +2600,13 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)
2600
2600
if (p12 != NULL ) {
2601
2601
bio_out = BIO_new_file (file_path , PHP_OPENSSL_BIO_MODE_W (PKCS7_BINARY ));
2602
2602
if (bio_out != NULL ) {
2603
-
2604
- i2d_PKCS12_bio (bio_out , p12 );
2603
+ if (i2d_PKCS12_bio (bio_out , p12 ) == 0 ) {
2604
+ php_openssl_store_errors ();
2605
+ php_error_docref (NULL , E_WARNING , "Error writing to file %s" , file_path );
2606
+ } else {
2607
+ RETVAL_TRUE ;
2608
+ }
2605
2609
BIO_free (bio_out );
2606
-
2607
- RETVAL_TRUE ;
2608
2610
} else {
2609
2611
php_openssl_store_errors ();
2610
2612
php_error_docref (NULL , E_WARNING , "Error opening file %s" , file_path );
@@ -5288,7 +5290,11 @@ PHP_FUNCTION(openssl_pkcs7_verify)
5288
5290
}
5289
5291
5290
5292
if (p7bout ) {
5291
- PEM_write_bio_PKCS7 (p7bout , p7 );
5293
+ if (PEM_write_bio_PKCS7 (p7bout , p7 ) == 0 ) {
5294
+ php_error_docref (NULL , E_WARNING , "Failed to write PKCS7 to file" );
5295
+ php_openssl_store_errors ();
5296
+ RETVAL_FALSE ;
5297
+ }
5292
5298
}
5293
5299
}
5294
5300
} else {
@@ -5873,7 +5879,11 @@ PHP_FUNCTION(openssl_cms_verify)
5873
5879
}
5874
5880
5875
5881
if (p7bout ) {
5876
- PEM_write_bio_CMS (p7bout , cms );
5882
+ if (PEM_write_bio_CMS (p7bout , cms ) == 0 ) {
5883
+ php_error_docref (NULL , E_WARNING , "Failed to write CMS to file" );
5884
+ php_openssl_store_errors ();
5885
+ RETVAL_FALSE ;
5886
+ }
5877
5887
}
5878
5888
}
5879
5889
} else {
0 commit comments