diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-04-26 23:05:26 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-04-26 23:05:26 +0200 |
commit | 872649c7baab3a9f7efdda78e49c4bc7dd481d91 (patch) | |
tree | 4fffb1a99ca36ccea65e64bcaa81293c40e7539f /extra/yassl/src/yassl_int.cpp | |
parent | 4995bcffaded6a02106632fb8f259cd3d9048dc4 (diff) | |
parent | 4f1ad43992d75676687f29da96dd7c4147247a8f (diff) | |
download | mariadb-git-872649c7baab3a9f7efdda78e49c4bc7dd481d91.tar.gz |
Merge branch '5.5' into 10.0
Diffstat (limited to 'extra/yassl/src/yassl_int.cpp')
-rw-r--r-- | extra/yassl/src/yassl_int.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index a38b7a5c81f..ff9c8155d0c 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1554,8 +1554,9 @@ void SSL_SESSION::CopyX509(X509* x) ASN1_TIME* after = x->GetAfter(); peerX509_ = NEW_YS X509(issuer->GetName(), issuer->GetLength(), - subject->GetName(), subject->GetLength(), - before, after); + subject->GetName(), subject->GetLength(), before, after, + issuer->GetCnPosition(), issuer->GetCnLength(), + subject->GetCnPosition(), subject->GetCnLength()); } @@ -2472,8 +2473,8 @@ void Security::set_resuming(bool b) } -X509_NAME::X509_NAME(const char* n, size_t sz) - : name_(0), sz_(sz) +X509_NAME::X509_NAME(const char* n, size_t sz, int pos, int len) + : name_(0), sz_(sz), cnPosition_(pos), cnLen_(len) { if (sz) { name_ = NEW_YS char[sz]; @@ -2503,8 +2504,10 @@ size_t X509_NAME::GetLength() const X509::X509(const char* i, size_t iSz, const char* s, size_t sSz, - ASN1_STRING *b, ASN1_STRING *a) - : issuer_(i, iSz), subject_(s, sSz), + ASN1_STRING *b, ASN1_STRING *a, + int issPos, int issLen, + int subPos, int subLen) + : issuer_(i, iSz, issPos, issLen), subject_(s, sSz, subPos, subLen), beforeDate_((char *) b->data, b->length, b->type), afterDate_((char *) a->data, a->length, a->type) {} @@ -2539,17 +2542,19 @@ ASN1_STRING* X509_NAME::GetEntry(int i) if (i < 0 || i >= int(sz_)) return 0; + if (i != cnPosition_ || cnLen_ <= 0) // only entry currently supported + return 0; + + if (cnLen_ > int(sz_-i)) // make sure there's room in read buffer + return 0; + if (entry_.data) ysArrayDelete(entry_.data); - entry_.data = NEW_YS byte[sz_]; // max size; + entry_.data = NEW_YS byte[cnLen_+1]; // max size; - memcpy(entry_.data, &name_[i], sz_ - i); - if (entry_.data[sz_ -i - 1]) { - entry_.data[sz_ - i] = 0; - entry_.length = int(sz_) - i; - } - else - entry_.length = int(sz_) - i - 1; + memcpy(entry_.data, &name_[i], cnLen_); + entry_.data[cnLen_] = 0; + entry_.length = cnLen_; entry_.type = 0; return &entry_; |