diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2009-10-30 14:47:37 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2009-10-30 14:47:37 +0000 |
| commit | 72eac3fd19fbc07efd7c62903d62b3c29c124317 (patch) | |
| tree | df5438b5b5b80129259d96396bb0d45c19e95b22 | |
| parent | 3c9e4965dd9ce072580f0cb58a0ad11980f9d8bd (diff) | |
Fix reporting of error in message parsing
* lasso/xml/xml.c:
do not mix the return code from xmlSecBase64Decode and the return
code for lasso_node_init_from_message_with_format.
It fixes a segmentation fault in
lasso_login_process_authn_request_msg.
| -rw-r--r-- | lasso/xml/xml.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 80bc938a..bc9644a6 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -1763,7 +1763,7 @@ lasso_node_init_from_message_with_format(LassoNode *node, const char *message, L { char *msg = NULL; gboolean b64 = FALSE; - LassoMessageFormat rc = LASSO_MESSAGE_FORMAT_UNKNOWN; + LassoMessageFormat rc = LASSO_MESSAGE_FORMAT_ERROR; xmlDoc *doc = NULL; xmlNode *root = NULL; gboolean any = constraint == LASSO_MESSAGE_FORMAT_UNKNOWN; @@ -1773,6 +1773,8 @@ lasso_node_init_from_message_with_format(LassoNode *node, const char *message, L /* BASE64 case */ if (any || constraint == LASSO_MESSAGE_FORMAT_BASE64) { if (message[0] != 0 && is_base64(message)) { + int rc; + msg = g_malloc(strlen(message)); rc = xmlSecBase64Decode((xmlChar*)message, (xmlChar*)msg, strlen(message)); if (rc >= 0) { @@ -1829,7 +1831,6 @@ lasso_node_init_from_message_with_format(LassoNode *node, const char *message, L if (strchr(msg, '&') || strchr(msg, '=')) { /* XXX: detect SAML artifact messages to return a different status code ? */ if (lasso_node_init_from_query(node, msg) == FALSE) { - rc = LASSO_MESSAGE_FORMAT_ERROR; goto cleanup; } rc = LASSO_MESSAGE_FORMAT_QUERY; |
