Clone chunk_t parameters in create function
[strongswan.git] / src / libpts / tcg / tcg_pts_attr_dh_nonce_params_resp.c
index 92d9cd7..cbbea4f 100644 (file)
@@ -168,7 +168,9 @@ METHOD(pa_tnc_attr_t, process, status_t,
        reader->read_uint16(reader, &hash_algo_set);
        this->hash_algo_set = hash_algo_set;
        reader->read_data(reader, this->nonce_len, &this->responder_nonce);
+       this->responder_nonce = chunk_clone(this->responder_nonce);
        reader->read_data(reader, reader->remaining(reader), &this->responder_pub_val);
+       this->responder_pub_val = chunk_clone(this->responder_pub_val);
        reader->destroy(reader);
 
        return SUCCESS;
@@ -247,8 +249,8 @@ pa_tnc_attr_t *tcg_pts_attr_dh_nonce_params_resp_create(u_int8_t nonce_len,
                .nonce_len = nonce_len,
                .dh_group = dh_group,
                .hash_algo_set = hash_algo_set,
-               .responder_nonce = responder_nonce,
-               .responder_pub_val = responder_pub_val,
+               .responder_nonce = chunk_clone(responder_nonce),
+               .responder_pub_val = chunk_clone(responder_pub_val),
        );
 
        return &this->public.pa_tnc_attribute;