diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-04-10 13:20:05 +0200 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-04-10 13:20:05 +0200 |
commit | a51a4c0462cef9e0bf172164837f1c1b4f73b08c (patch) | |
tree | 92be2ef88622a9e1953e63b05351abfc17bea646 /src/identity-attribute | |
parent | 3eae3e43d6f94449cb89998a676e6696438cc604 (diff) | |
download | gnunet-a51a4c0462cef9e0bf172164837f1c1b4f73b08c.tar.gz gnunet-a51a4c0462cef9e0bf172164837f1c1b4f73b08c.zip |
fix mem corruption
Diffstat (limited to 'src/identity-attribute')
-rw-r--r-- | src/identity-attribute/identity_attribute.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/identity-attribute/identity_attribute.c b/src/identity-attribute/identity_attribute.c index 0111668fe..dc2753fca 100644 --- a/src/identity-attribute/identity_attribute.c +++ b/src/identity-attribute/identity_attribute.c | |||
@@ -336,18 +336,15 @@ GNUNET_IDENTITY_ATTRIBUTE_list_dup (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim | |||
336 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; | 336 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; |
337 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *result_le; | 337 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *result_le; |
338 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *result; | 338 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *result; |
339 | size_t len; | ||
340 | 339 | ||
341 | result = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); | 340 | result = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); |
342 | for (le = attrs->list_head; NULL != le; le = le->next) | 341 | for (le = attrs->list_head; NULL != le; le = le->next) |
343 | { | 342 | { |
344 | result_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); | 343 | result_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); |
345 | len = sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) + le->claim->data_size; | 344 | result_le->claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (le->claim->name, |
346 | result_le->claim = GNUNET_malloc (len); | 345 | le->claim->type, |
347 | GNUNET_memcpy (result_le->claim, | 346 | le->claim->data, |
348 | le->claim, | 347 | le->claim->data_size); |
349 | len); | ||
350 | result_le->claim->name = (const char*)&result_le->claim[1]; | ||
351 | GNUNET_CONTAINER_DLL_insert (result->list_head, | 348 | GNUNET_CONTAINER_DLL_insert (result->list_head, |
352 | result->list_tail, | 349 | result->list_tail, |
353 | result_le); | 350 | result_le); |