From: Luke Howard Date: Sun, 3 Apr 2011 07:57:09 +0000 (+1000) Subject: Don't crash if there are zero valued attributes X-Git-Url: http://www.project-moonshot.org/gitweb/?p=moonshot.git;a=commitdiff_plain;h=e5237805e6fe2fc28c8b54304e34d51c0b5d4e53 Don't crash if there are zero valued attributes --- diff --git a/mech_eap/util_saml.cpp b/mech_eap/util_saml.cpp index fd84e44..26bf544 100644 --- a/mech_eap/util_saml.cpp +++ b/mech_eap/util_saml.cpp @@ -662,7 +662,7 @@ gss_eap_saml_attr_provider::getAttribute(const gss_buffer_t attr, if (i == -1) i = 0; - else if (i >= nvalues) + if (i >= nvalues) return false; #ifdef __APPLE__ av = (const saml2::AttributeValue *)((void *)(a->getAttributeValues().at(i))); diff --git a/mech_eap/util_shib.cpp b/mech_eap/util_shib.cpp index 07ee06c..778ad25 100644 --- a/mech_eap/util_shib.cpp +++ b/mech_eap/util_shib.cpp @@ -331,7 +331,7 @@ gss_eap_shib_attr_provider::getAttribute(const gss_buffer_t attr, if (i == -1) i = 0; - else if (i >= nvalues) + if (i >= nvalues) return false; buf.value = (void *)shibAttr->getSerializedValues()[*more].c_str();