aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-03-22 11:34:16 +0100
committerTobias Brunner <tobias@strongswan.org>2013-03-22 11:34:16 +0100
commit03237238b8c3d4a00f5414adeb02390548b1710b (patch)
tree48c70248f1d88e23341647ff2d410518ea65d9ef /src
parent753e0a0099c33f7831e0cadcaa63c4a2a146eb15 (diff)
downloadstrongswan-03237238b8c3d4a00f5414adeb02390548b1710b.tar.bz2
strongswan-03237238b8c3d4a00f5414adeb02390548b1710b.tar.xz
Check return value of asprintf(3) when converting AR identity
Using chunk_t.ptr as target was also not optimal as it resulted in a compiler warning.
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c b/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c
index 76d5e1d9f..36bab7068 100644
--- a/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c
+++ b/src/libcharon/plugins/tnc_tnccs/tnc_tnccs_manager.c
@@ -719,6 +719,7 @@ METHOD(tnccs_manager_t, get_attribute, TNC_Result,
tncif_identity_t *tnc_id;
u_int32_t id_type, subject_type;
chunk_t id_value;
+ char *id_str;
TNC_Result result;
list = linked_list_create();
@@ -752,9 +753,10 @@ METHOD(tnccs_manager_t, get_attribute, TNC_Result,
id_type = TNC_ID_UNKNOWN;
subject_type = TNC_SUBJECT_UNKNOWN;
}
- if (id_type != TNC_ID_UNKNOWN)
+ if (id_type != TNC_ID_UNKNOWN &&
+ asprintf(&id_str, "%Y", peer) >= 0)
{
- id_value.len = asprintf(&id_value.ptr, "%Y", peer);
+ id_value = chunk_from_str(id_str);
tnc_id = tncif_identity_create(
pen_type_create(PEN_TCG, id_type), id_value,
pen_type_create(PEN_TCG, subject_type),