summaryrefslogtreecommitdiff
path: root/ext/openssl/openssl.c
diff options
context:
space:
mode:
authorTimm Friebe <thekid@thekid.de>2014-07-06 17:07:01 +0200
committerTimm Friebe <thekid@thekid.de>2014-07-06 17:07:01 +0200
commita1554ca6343598c38e4fb4fbcc46419ce0bdf058 (patch)
treee66e73ff23a340cf7343459a0331a57b8eff65aa /ext/openssl/openssl.c
parente0d51d1cf00d43c57104764b620bb9219889a86d (diff)
parent5b925824edf3edc951fc41608d5cbd07a0baab08 (diff)
downloadphp-git-a1554ca6343598c38e4fb4fbcc46419ce0bdf058.tar.gz
Merge in changes from master
Now also includes "on [TYPE]" in "Call to a member function" error
Diffstat (limited to 'ext/openssl/openssl.c')
-rwxr-xr-xext/openssl/openssl.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 4f8f4b7334..118dcd99c2 100755
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -708,7 +708,7 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */
char * thestr;
long gmadjust = 0;
- if (ASN1_STRING_type(timestr) != V_ASN1_UTCTIME) {
+ if (ASN1_STRING_type(timestr) != V_ASN1_UTCTIME && ASN1_STRING_type(timestr) != V_ASN1_GENERALIZEDTIME) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "illegal ASN1 data type for timestamp");
return (time_t)-1;
}
@@ -723,6 +723,11 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */
return (time_t)-1;
}
+ if (ASN1_STRING_type(timestr) == V_ASN1_GENERALIZEDTIME && ASN1_STRING_length(timestr) < 15) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to parse time string %s correctly", timestr->data);
+ return (time_t)-1;
+ }
+
strbuf = estrdup((char *)ASN1_STRING_data(timestr));
memset(&thetime, 0, sizeof(thetime));
@@ -744,14 +749,21 @@ static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */
*thestr = '\0';
thestr -= 2;
thetime.tm_mon = atoi(thestr)-1;
+
*thestr = '\0';
- thestr -= 2;
- thetime.tm_year = atoi(thestr);
+ if( ASN1_STRING_type(timestr) == V_ASN1_UTCTIME ) {
+ thestr -= 2;
+ thetime.tm_year = atoi(thestr);
- if (thetime.tm_year < 68) {
- thetime.tm_year += 100;
+ if (thetime.tm_year < 68) {
+ thetime.tm_year += 100;
+ }
+ } else if( ASN1_STRING_type(timestr) == V_ASN1_GENERALIZEDTIME ) {
+ thestr -= 4;
+ thetime.tm_year = atoi(thestr) - 1900;
}
+
thetime.tm_isdst = -1;
ret = mktime(&thetime);