@@ -2712,16 +2712,21 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
27122712 /* tack on extra headers */
27132713 if (zheaders ) {
27142714 ZEND_HASH_FOREACH_STR_KEY_VAL (Z_ARRVAL_P (zheaders ), strindex , zcertval ) {
2715+ int ret ;
27152716 zend_string * str = zval_try_get_string (zcertval );
27162717 if (UNEXPECTED (!str )) {
27172718 goto clean_exit ;
27182719 }
27192720 if (strindex ) {
2720- BIO_printf (outfile , "%s: %s\n" , ZSTR_VAL (strindex ), ZSTR_VAL (str ));
2721+ ret = BIO_printf (outfile , "%s: %s\n" , ZSTR_VAL (strindex ), ZSTR_VAL (str ));
27212722 } else {
2722- BIO_printf (outfile , "%s\n" , ZSTR_VAL (str ));
2723+ ret = BIO_printf (outfile , "%s\n" , ZSTR_VAL (str ));
27232724 }
27242725 zend_string_release (str );
2726+ if (ret < 0 ) {
2727+ php_openssl_store_errors ();
2728+ goto clean_exit ;
2729+ }
27252730 } ZEND_HASH_FOREACH_END ();
27262731 }
27272732
@@ -2941,6 +2946,7 @@ PHP_FUNCTION(openssl_pkcs7_sign)
29412946 zend_string_release (str );
29422947 if (ret < 0 ) {
29432948 php_openssl_store_errors ();
2949+ goto clean_exit ;
29442950 }
29452951 } ZEND_HASH_FOREACH_END ();
29462952 }
@@ -3341,16 +3347,21 @@ PHP_FUNCTION(openssl_cms_encrypt)
33413347 /* tack on extra headers */
33423348 if (zheaders && encoding == ENCODING_SMIME ) {
33433349 ZEND_HASH_FOREACH_STR_KEY_VAL (Z_ARRVAL_P (zheaders ), strindex , zcertval ) {
3350+ int ret ;
33443351 zend_string * str = zval_try_get_string (zcertval );
33453352 if (UNEXPECTED (!str )) {
33463353 goto clean_exit ;
33473354 }
33483355 if (strindex ) {
3349- BIO_printf (outfile , "%s: %s\n" , ZSTR_VAL (strindex ), ZSTR_VAL (str ));
3356+ ret = BIO_printf (outfile , "%s: %s\n" , ZSTR_VAL (strindex ), ZSTR_VAL (str ));
33503357 } else {
3351- BIO_printf (outfile , "%s\n" , ZSTR_VAL (str ));
3358+ ret = BIO_printf (outfile , "%s\n" , ZSTR_VAL (str ));
33523359 }
33533360 zend_string_release (str );
3361+ if (ret < 0 ) {
3362+ php_openssl_store_errors ();
3363+ goto clean_exit ;
3364+ }
33543365 } ZEND_HASH_FOREACH_END ();
33553366 }
33563367
@@ -3631,6 +3642,7 @@ PHP_FUNCTION(openssl_cms_sign)
36313642 zend_string_release (str );
36323643 if (ret < 0 ) {
36333644 php_openssl_store_errors ();
3645+ goto clean_exit ;
36343646 }
36353647 } ZEND_HASH_FOREACH_END ();
36363648 }
0 commit comments