summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2015-06-23 14:31:24 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2015-09-01 14:32:42 (GMT)
commit29897506c70c08ef17527df12eee6511311a2bad (patch)
tree60321d4867b614117aea03e893c02b763ad2d1ed
parentb10c48058ed5942b135712f46888e0697fb593ff (diff)
downloadlasso-29897506c70c08ef17527df12eee6511311a2bad.zip
lasso-29897506c70c08ef17527df12eee6511311a2bad.tar.gz
lasso-29897506c70c08ef17527df12eee6511311a2bad.tar.bz2
Fix coverity lasso_get_hmac_key() warning
lasso_get_hmac_key() did not check return value. Now check the return code, emit a critical message and return early with cleanup. Signed-off-by: John Dennis <jdennis@redhat.com> License: MIT
-rw-r--r--lasso/xml/tools.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c
index 8c9b21e..41fd573 100644
--- a/lasso/xml/tools.c
+++ b/lasso/xml/tools.c
@@ -494,6 +494,7 @@ lasso_query_sign(char *query, LassoSignatureContext context)
xmlSecKeyData *key_data;
unsigned int sigret_size = 0;
LassoSignatureMethod sign_method;
+ lasso_error_t rc = 0;
g_return_val_if_fail(query != NULL, NULL);
g_return_val_if_fail(lasso_validate_signature_method(context.signature_method), NULL);
@@ -594,8 +595,11 @@ lasso_query_sign(char *query, LassoSignatureContext context)
case LASSO_SIGNATURE_METHOD_HMAC_SHA256:
case LASSO_SIGNATURE_METHOD_HMAC_SHA384:
case LASSO_SIGNATURE_METHOD_HMAC_SHA512:
- lasso_get_hmac_key(key, (void**)&hmac_key,
- &hmac_key_length);
+ if ((rc = lasso_get_hmac_key(key, (void**)&hmac_key,
+ &hmac_key_length))) {
+ message(G_LOG_LEVEL_CRITICAL, "Failed to get hmac key (%s)", lasso_strerror(rc));
+ goto done;
+ }
g_assert(hmac_key);
md = EVP_sha1();
sigret_size = EVP_MD_size(md);