4
0
mirror of https://github.com/QuasarApp/qca.git synced 2025-05-12 18:49:34 +00:00

Remove QChar::Null from latin1 strings

QString::fromLatin1(QByteArray) includes the null characters from the
byte array which makes BigInteger and Certificate tests fail since
QCOMPARE distinguishes between QString("123") and QString("123\u0000").
This commit is contained in:
Tobias Junghans 2021-05-10 09:33:22 +02:00 committed by Albert Astals Cid
parent 9443ba76ba
commit d8f1e6cb9c
2 changed files with 4 additions and 2 deletions
plugins/qca-ossl
src

@ -838,8 +838,9 @@ static QStringList get_cert_policies(X509_EXTENSION *ex)
for (int n = 0; n < sk_POLICYINFO_num(pols); ++n) {
POLICYINFO *pol = sk_POLICYINFO_value(pols, n);
QByteArray buf(128, 0);
OBJ_obj2txt((char *)buf.data(), buf.size(), pol->policyid, 1); // 1 = only accept dotted input
out += QString::fromLatin1(buf);
const auto len = OBJ_obj2txt((char *)buf.data(), buf.size(), pol->policyid, 1); // 1 = only accept dotted input
if (len > 0)
out += QString::fromLatin1(buf.left(len));
}
sk_POLICYINFO_pop_free(pols, POLICYINFO_free);
return out;

@ -909,6 +909,7 @@ QString BigInteger::toString() const
if (d->n.is_negative())
str += QLatin1Char('-');
str += QString::fromLatin1(cs);
str.remove(QChar::Null);
return str;
}