@@ -474,9 +474,9 @@ void php_openssl_store_errors(void)
474474 errors = OPENSSL_G (errors );
475475
476476 do {
477- errors -> top = (errors -> top + 1 ) % ERR_NUM_ERRORS ;
477+ errors -> top = (errors -> top + 1 ) % PHP_OPENSSL_ERR_BUFFER_SIZE ;
478478 if (errors -> top == errors -> bottom ) {
479- errors -> bottom = (errors -> bottom + 1 ) % ERR_NUM_ERRORS ;
479+ errors -> bottom = (errors -> bottom + 1 ) % PHP_OPENSSL_ERR_BUFFER_SIZE ;
480480 }
481481 errors -> buffer [errors -> top ] = error_code ;
482482 } while ((error_code = ERR_get_error ()));
@@ -721,7 +721,7 @@ static void php_openssl_add_assoc_name_entry(zval * val, char * key, X509_NAME *
721721
722722static void php_openssl_add_assoc_asn1_string (zval * val , char * key , ASN1_STRING * str ) /* {{{ */
723723{
724- add_assoc_stringl (val , key , (char * )str -> data , str -> length );
724+ add_assoc_stringl (val , key , (const char * )ASN1_STRING_get0_data ( str ), ASN1_STRING_length ( str ) );
725725}
726726/* }}} */
727727
@@ -754,12 +754,12 @@ static time_t php_openssl_asn1_time_to_time_t(ASN1_UTCTIME * timestr) /* {{{ */
754754 }
755755
756756 if (timestr_len < 13 && timestr_len != 11 ) {
757- php_error_docref (NULL , E_WARNING , "Unable to parse time string %s correctly" , timestr -> data );
757+ php_error_docref (NULL , E_WARNING , "Unable to parse time string %s correctly" , ASN1_STRING_get0_data ( timestr ) );
758758 return (time_t )- 1 ;
759759 }
760760
761761 if (ASN1_STRING_type (timestr ) == V_ASN1_GENERALIZEDTIME && timestr_len < 15 ) {
762- php_error_docref (NULL , E_WARNING , "Unable to parse time string %s correctly" , timestr -> data );
762+ php_error_docref (NULL , E_WARNING , "Unable to parse time string %s correctly" , ASN1_STRING_get0_data ( timestr ) );
763763 return (time_t )- 1 ;
764764 }
765765
@@ -2022,8 +2022,8 @@ static int openssl_x509v3_subjectAltName(BIO *bio, X509_EXTENSION *extension)
20222022 }
20232023
20242024 extension_data = X509_EXTENSION_get_data (extension );
2025- p = extension_data -> data ;
2026- length = extension_data -> length ;
2025+ p = ASN1_STRING_get0_data ( extension_data ) ;
2026+ length = ASN1_STRING_length ( extension_data ) ;
20272027 if (method -> it ) {
20282028 names = (GENERAL_NAMES * ) (ASN1_item_d2i (NULL , & p , length ,
20292029 ASN1_ITEM_ptr (method -> it )));
@@ -6928,7 +6928,7 @@ PHP_FUNCTION(openssl_error_string)
69286928 RETURN_FALSE ;
69296929 }
69306930
6931- OPENSSL_G (errors )-> bottom = (OPENSSL_G (errors )-> bottom + 1 ) % ERR_NUM_ERRORS ;
6931+ OPENSSL_G (errors )-> bottom = (OPENSSL_G (errors )-> bottom + 1 ) % PHP_OPENSSL_ERR_BUFFER_SIZE ;
69326932 val = OPENSSL_G (errors )-> buffer [OPENSSL_G (errors )-> bottom ];
69336933
69346934 if (val ) {
0 commit comments