have_recommendation() accepts NULL arguments
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 11 Jul 2012 11:02:19 +0000 (13:02 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 11 Jul 2012 15:09:05 +0000 (17:09 +0200)
src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.c

index 7843293..64cdbcb 100644 (file)
@@ -123,8 +123,13 @@ METHOD(recommendations_t, have_recommendation, bool,
        TNC_IMV_Evaluation_Result final_eval;
        bool first = TRUE, incomplete = FALSE;
 
-       *rec = final_rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION;
-       *eval = final_eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
+       final_rec  = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION;
+       final_eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
+       if (rec && eval)
+       {
+               *rec  = final_rec;
+               *eval = final_eval;
+       }
 
        if (this->recs->get_count(this->recs) == 0)
        {
@@ -267,8 +272,11 @@ METHOD(recommendations_t, have_recommendation, bool,
        {
                return FALSE;
        }
-       *rec = final_rec;
-       *eval = final_eval;
+       if (rec && eval)
+       {
+               *rec  = final_rec;
+               *eval = final_eval;
+       }
        return TRUE;
 }