[es] Fixed a bug where string fields were not imported correctly.

This commit is contained in:
jakcron 2018-07-29 20:51:15 +09:00
parent 2f9cba6d40
commit 3a4259d2cc
2 changed files with 3 additions and 3 deletions

View file

@ -129,10 +129,10 @@ void es::CertificateBody::fromBytes(const byte_t* src, size_t size)
hdr = (const sCertificateHeader*)mRawBinary.data(); hdr = (const sCertificateHeader*)mRawBinary.data();
if (hdr->issuer[0] != 0) if (hdr->issuer[0] != 0)
mIssuer = std::string(hdr->issuer, cert::kIssuerSize); mIssuer = std::string(hdr->issuer, _MIN(strlen(hdr->issuer), cert::kIssuerSize));
mPublicKeyType = (cert::PublicKeyType)hdr->key_type.get(); mPublicKeyType = (cert::PublicKeyType)hdr->key_type.get();
if (hdr->subject[0] != 0) if (hdr->subject[0] != 0)
mSubject = std::string(hdr->subject, cert::kSubjectSize); mSubject = std::string(hdr->subject, _MIN(strlen(hdr->subject), cert::kSubjectSize));
mCertId = hdr->cert_id.get(); mCertId = hdr->cert_id.get();
// save public key // save public key

View file

@ -112,7 +112,7 @@ void es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len)
throw fnd::Exception(kModuleName, "Unsupported format version"); throw fnd::Exception(kModuleName, "Unsupported format version");
} }
mIssuer.append(body->issuer, ticket::kIssuerSize); mIssuer = std::string(body->issuer, _MIN(strlen(body->issuer), ticket::kIssuerSize));
memcpy(mEncTitleKey, body->enc_title_key, ticket::kEncTitleKeySize); memcpy(mEncTitleKey, body->enc_title_key, ticket::kEncTitleKeySize);
mEncType = (ticket::TitleKeyEncType)body->title_key_enc_type; mEncType = (ticket::TitleKeyEncType)body->title_key_enc_type;
mTicketVersion = body->ticket_version.get(); mTicketVersion = body->ticket_version.get();