diff --git a/lib/libes/source/CertificateBody.cpp b/lib/libes/source/CertificateBody.cpp index 11bec02..6219a21 100644 --- a/lib/libes/source/CertificateBody.cpp +++ b/lib/libes/source/CertificateBody.cpp @@ -129,10 +129,10 @@ void es::CertificateBody::fromBytes(const byte_t* src, size_t size) hdr = (const sCertificateHeader*)mRawBinary.data(); 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(); 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(); // save public key diff --git a/lib/libes/source/TicketBody_V2.cpp b/lib/libes/source/TicketBody_V2.cpp index 8e19726..93816c7 100644 --- a/lib/libes/source/TicketBody_V2.cpp +++ b/lib/libes/source/TicketBody_V2.cpp @@ -112,7 +112,7 @@ void es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len) 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); mEncType = (ticket::TitleKeyEncType)body->title_key_enc_type; mTicketVersion = body->ticket_version.get();