summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2020-06-03 04:50:39 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2020-06-03 04:52:27 -0500
commit47c8c586908605d2f52636701a0a265231750d84 (patch)
tree6b6cd55b7d9061addb5ccbef27e2eafb9fcd0613
parentc3ddf69f512430700ee885c4934e8f7176e59def (diff)
downloadlibtdeldap-47c8c586908605d2f52636701a0a265231750d84.tar.gz
libtdeldap-47c8c586908605d2f52636701a0a265231750d84.zip
Fix crash if empty certificate is provided in PKI list
-rw-r--r--src/libtdeldap.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index c217398..b92ed47 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -1069,6 +1069,10 @@ int LDAPManager::updateUserInfo(LDAPUserInfo user, TQString *errstr) {
for (it = user.pkiCertificates.begin(); it != user.pkiCertificates.end(); ++it) {
PKICertificateEntry certificateData = *it;
+ // Don't attempt to load empty certificates
+ if (certificateData.second.size() < 1)
+ continue;
+
TQCString ssldata(certificateData.second);
ssldata[certificateData.second.size()] = 0;
ssldata.replace("-----BEGIN CERTIFICATE-----", "");
@@ -4750,6 +4754,10 @@ int LDAPManager::generatePKICRL(int expirydays, LDAPRealmConfig realmcfg, TQStri
for (it = user.pkiCertificates.begin(); it != user.pkiCertificates.end(); ++it) {
PKICertificateEntry certificateData = *it;
+ // Don't attempt to load empty certificates
+ if (certificateData.second.size() < 1)
+ continue;
+
TQCString ssldata(certificateData.second);
ssldata[certificateData.second.size()] = 0;
ssldata.replace("-----BEGIN CERTIFICATE-----", "");