@@ -2703,16 +2703,21 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
27032703 /* tack on extra headers */
27042704 if (zheaders ) {
27052705 ZEND_HASH_FOREACH_STR_KEY_VAL (Z_ARRVAL_P (zheaders ), strindex , zcertval ) {
2706+ int ret ;
27062707 zend_string * str = zval_try_get_string (zcertval );
27072708 if (UNEXPECTED (!str )) {
27082709 goto clean_exit ;
27092710 }
27102711 if (strindex ) {
2711- BIO_printf (outfile , "%s: %s\n" , ZSTR_VAL (strindex ), ZSTR_VAL (str ));
2712+ ret = BIO_printf (outfile , "%s: %s\n" , ZSTR_VAL (strindex ), ZSTR_VAL (str ));
27122713 } else {
2713- BIO_printf (outfile , "%s\n" , ZSTR_VAL (str ));
2714+ ret = BIO_printf (outfile , "%s\n" , ZSTR_VAL (str ));
27142715 }
27152716 zend_string_release (str );
2717+ if (ret < 0 ) {
2718+ php_openssl_store_errors ();
2719+ goto clean_exit ;
2720+ }
27162721 } ZEND_HASH_FOREACH_END ();
27172722 }
27182723
@@ -2932,6 +2937,7 @@ PHP_FUNCTION(openssl_pkcs7_sign)
29322937 zend_string_release (str );
29332938 if (ret < 0 ) {
29342939 php_openssl_store_errors ();
2940+ goto clean_exit ;
29352941 }
29362942 } ZEND_HASH_FOREACH_END ();
29372943 }
@@ -3332,16 +3338,21 @@ PHP_FUNCTION(openssl_cms_encrypt)
33323338 /* tack on extra headers */
33333339 if (zheaders && encoding == ENCODING_SMIME ) {
33343340 ZEND_HASH_FOREACH_STR_KEY_VAL (Z_ARRVAL_P (zheaders ), strindex , zcertval ) {
3341+ int ret ;
33353342 zend_string * str = zval_try_get_string (zcertval );
33363343 if (UNEXPECTED (!str )) {
33373344 goto clean_exit ;
33383345 }
33393346 if (strindex ) {
3340- BIO_printf (outfile , "%s: %s\n" , ZSTR_VAL (strindex ), ZSTR_VAL (str ));
3347+ ret = BIO_printf (outfile , "%s: %s\n" , ZSTR_VAL (strindex ), ZSTR_VAL (str ));
33413348 } else {
3342- BIO_printf (outfile , "%s\n" , ZSTR_VAL (str ));
3349+ ret = BIO_printf (outfile , "%s\n" , ZSTR_VAL (str ));
33433350 }
33443351 zend_string_release (str );
3352+ if (ret < 0 ) {
3353+ php_openssl_store_errors ();
3354+ goto clean_exit ;
3355+ }
33453356 } ZEND_HASH_FOREACH_END ();
33463357 }
33473358
@@ -3622,6 +3633,7 @@ PHP_FUNCTION(openssl_cms_sign)
36223633 zend_string_release (str );
36233634 if (ret < 0 ) {
36243635 php_openssl_store_errors ();
3636+ goto clean_exit ;
36253637 }
36263638 } ZEND_HASH_FOREACH_END ();
36273639 }
0 commit comments