check for malformed IKE and ESP proposals
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 1 Dec 2010 08:50:30 +0000 (09:50 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 1 Dec 2010 08:50:30 +0000 (09:50 +0100)
src/libcharon/config/proposal.c
src/libcharon/plugins/sql/sql_config.c

index 5b82945..f680982 100644 (file)
@@ -560,6 +560,7 @@ static status_t add_string_algo(private_proposal_t *this, chunk_t alg)
 
        if (token == NULL)
        {
+               DBG1(DBG_CFG, "algorithm '%.*s' not recognized", alg.len, alg.ptr);
                return FAILED;
        }
 
index f81fc0b..a4e718f 100644 (file)
@@ -140,6 +140,11 @@ static void add_esp_proposals(private_sql_config_t *this,
                while (e->enumerate(e, &prop))
                {
                        proposal = proposal_create_from_string(PROTO_ESP, prop);
+                       if (!proposal)
+                       {
+                               DBG1(DBG_CFG, "could not create ESP proposal from '%s'", prop);
+                               break;
+                       }
                        child->add_proposal(child, proposal);
                        use_default = FALSE;
                }
@@ -223,6 +228,11 @@ static void add_ike_proposals(private_sql_config_t *this,
                while (e->enumerate(e, &prop))
                {
                        proposal = proposal_create_from_string(PROTO_IKE, prop);
+                       if (!proposal)
+                       {
+                               DBG1(DBG_CFG, "could not create IKE proposal from '%s'", prop);
+                               break;
+                       }
                        ike_cfg->add_proposal(ike_cfg, proposal);
                        use_default = FALSE;
                }