diff options
| author | Simo Sorce <simo@redhat.com> | 2014-06-09 13:50:10 -0400 |
|---|---|---|
| committer | Simo Sorce <simo@redhat.com> | 2014-06-09 15:08:35 -0400 |
| commit | ed94ee95b56c0b85edc71907fb98868331c7411d (patch) | |
| tree | bb10c73cdfb590b646cc3625c50a5bd7e660959e | |
| parent | bbb6a2b403fd1e961db752afe1072d616d10ba0d (diff) | |
| download | lasso-ed94ee95b56c0b85edc71907fb98868331c7411d.tar.gz lasso-ed94ee95b56c0b85edc71907fb98868331c7411d.tar.xz lasso-ed94ee95b56c0b85edc71907fb98868331c7411d.zip | |
Consistently check dsig_reference_ctx
Check if this is not NULL in all cases, to avoid NULL pointer dereference.
Found by clang
License: MIT
Signed-off-by: Simo Sorce <simo@redhat.com>
| -rw-r--r-- | lasso/xml/tools.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c index 2e575b86..afbb8b6b 100644 --- a/lasso/xml/tools.c +++ b/lasso/xml/tools.c @@ -1382,6 +1382,7 @@ lasso_verify_signature(xmlNode *signed_node, xmlDoc *doc, const char *id_attr_na lasso_strisequal((char*)dsig_reference_ctx->uri, reference_uri); ok |= (signature_verification_option & EMPTY_URI) && xmlDocGetRootElement(doc) == signed_node + && dsig_reference_ctx != NULL && lasso_strisequal((char*)dsig_reference_ctx->uri, ""); goto_cleanup_if_fail_with_rc(ok, LASSO_DS_ERROR_INVALID_REFERENCE_FOR_SAML); @@ -1393,7 +1394,8 @@ lasso_verify_signature(xmlNode *signed_node, xmlDoc *doc, const char *id_attr_na for (i = 0; i < size; ++i) { dsig_reference_ctx = (xmlSecDSigReferenceCtx*)xmlSecPtrListGetItem(&(dsigCtx->signedInfoReferences), i); - if (dsig_reference_ctx->uri == NULL) { + if (dsig_reference_ctx == NULL || + dsig_reference_ctx->uri == NULL) { message(G_LOG_LEVEL_CRITICAL, "dsig_reference_ctx->uri cannot be null"); continue; } |
