chunk_clone after read_data
authorSansar Choinyambuu <schoinya@hsr.ch>
Wed, 24 Aug 2011 10:50:00 +0000 (12:50 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 8 Sep 2011 10:08:13 +0000 (12:08 +0200)
src/libimcv/tcg/tcg_pts_attr_file_meas.c
src/libimcv/tcg/tcg_pts_attr_req_file_meas.c
src/libimcv/tcg/tcg_pts_attr_simple_comp_evid.c
src/libimcv/tcg/tcg_pts_attr_simple_evid_final.c

index 362f9ed..e579063 100644 (file)
@@ -197,6 +197,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
                reader->read_data (reader, this->meas_len, &entry->measurement);
                reader->read_uint16 (reader, &entry->file_name_len);
                reader->read_data(reader, entry->file_name_len, &entry->file_name);
+               entry->file_name = chunk_clone(entry->file_name);
                this->measurements->insert_last(this->measurements, entry);
        }
 
index 3b5ac33..8028caa 100644 (file)
@@ -153,6 +153,8 @@ METHOD(pa_tnc_attr_t, process, status_t,
        u_int8_t reserved;
        u_int32_t file_path_len;
        
+       char *temp;
+       
        if (this->value.len < PTS_REQ_FILE_MEAS_SIZE)
        {
                DBG1(DBG_TNC, "insufficient data for Request File Measurement");
@@ -168,8 +170,11 @@ METHOD(pa_tnc_attr_t, process, status_t,
        reader->read_uint16(reader, &this->request_id);
        reader->read_uint32(reader, &this->delimiter);
        file_path_len = reader->remaining(reader);
+       
        reader->read_data(reader, file_path_len, &this->path);
-
+       this->path = chunk_clone(this->path);
+       
+       DBG1(DBG_TNC, " ****** Request ID: %d File path len: %d Path: %s", this->request_id, file_path_len, this->path.ptr);
        reader->destroy(reader);
        return SUCCESS; 
 }
index c33ac22..f4c0a03 100644 (file)
@@ -413,6 +413,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
        
        reader->read_data(reader, PTS_SIMPLE_COMP_EVID_MEASUREMENT_TIME_SIZE,
                          &this->measurement_time);
+       this->measurement_time = chunk_clone(this->measurement_time);
        
        /*  Optional Policy URI field is included */
        if (this->flags & PTS_SIMPLE_COMP_EVID_FLAG_VER_FAIL || 
@@ -421,6 +422,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
                u_int16_t policy_uri_len;
                reader->read_uint16(reader, &policy_uri_len);
                reader->read_data(reader, policy_uri_len, &this->policy_uri);
+               this->policy_uri = chunk_clone(this->policy_uri);
        }
        
        /*  Optional PCR value fields are included */
@@ -429,11 +431,14 @@ METHOD(pa_tnc_attr_t, process, status_t,
                u_int16_t pcr_value_len;
                reader->read_uint16(reader, &pcr_value_len);
                reader->read_data(reader, pcr_value_len, &this->pcr_before);
+               this->pcr_before = chunk_clone(this->pcr_before);
                reader->read_data(reader, pcr_value_len, &this->pcr_after);
+               this->pcr_after = chunk_clone(this->pcr_after);
        }
        
        measurement_len = reader->remaining(reader);
        reader->read_data(reader, measurement_len, &this->measurement);
+       this->measurement = chunk_clone(this->measurement);
 
        reader->destroy(reader);
        return SUCCESS; 
index f37576e..1d76df8 100644 (file)
@@ -233,8 +233,10 @@ METHOD(pa_tnc_attr_t, process, status_t,
                u_int32_t tpm_quote_sign_len;
                reader->read_uint32(reader, &pcr_comp_len);
                reader->read_data(reader, pcr_comp_len, &this->pcr_comp);
+               this->pcr_comp = chunk_clone(this->pcr_comp);
                reader->read_uint32(reader, &tpm_quote_sign_len);
                reader->read_data(reader, tpm_quote_sign_len, &this->tpm_quote_sign);
+               this->tpm_quote_sign = chunk_clone(this->tpm_quote_sign);
        }
        
        /*  Optional Evidence Signature field is included */
@@ -242,6 +244,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
        {
                u_int32_t evid_sign_len = reader->remaining(reader);
                reader->read_data(reader, evid_sign_len, &this->evid_sign);
+               this->evid_sign = chunk_clone(this->evid_sign);
        }
        
        reader->destroy(reader);