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