From: Schanzenbach, Martin Date: Tue, 10 Apr 2018 11:20:05 +0000 (+0200) Subject: fix mem corruption X-Git-Tag: v0.11.0pre66~120 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a51a4c0462cef9e0bf172164837f1c1b4f73b08c;p=oweals%2Fgnunet.git fix mem corruption --- 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 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *result_le; struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *result; - size_t len; result = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); for (le = attrs->list_head; NULL != le; le = le->next) { result_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); - len = sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) + le->claim->data_size; - result_le->claim = GNUNET_malloc (len); - GNUNET_memcpy (result_le->claim, - le->claim, - len); - result_le->claim->name = (const char*)&result_le->claim[1]; + result_le->claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (le->claim->name, + le->claim->type, + le->claim->data, + le->claim->data_size); GNUNET_CONTAINER_DLL_insert (result->list_head, result->list_tail, result_le); diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index a518d00ae..b738ffc82 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c @@ -1325,6 +1325,14 @@ check_attr_error (void *cls) cleanup_revoke_ticket_handle (rh); } + +/** + * Revoke next attribte by reencryption with + * new ABE master + */ +static void +reenc_next_attribute (void *cls); + /** * Check for existing attribute and overwrite */ @@ -1344,7 +1352,12 @@ check_attr_cb (void *cls, size_t buf_size; char* policy; uint32_t attr_ver; - + + if (1 != rd_count) { + GNUNET_SCHEDULER_add_now (&reenc_next_attribute, + rh); + return; + } buf_size = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (rh->attrs->list_head->claim); buf = GNUNET_malloc (buf_size); @@ -1407,8 +1420,9 @@ check_attr_cb (void *cls, * new ABE master */ static void -reenc_next_attribute (struct TicketRevocationHandle *rh) +reenc_next_attribute (void *cls) { + struct TicketRevocationHandle *rh = cls; if (NULL == rh->attrs->list_head) { revocation_reissue_tickets (rh); diff --git a/src/identity-provider/test_idp.conf b/src/identity-provider/test_idp.conf index b11b43ae2..5480e4975 100644 --- a/src/identity-provider/test_idp.conf +++ b/src/identity-provider/test_idp.conf @@ -30,4 +30,4 @@ DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 [identity-rest-plugin] address = http://localhost:8000/#/login psw = mysupersecretpassword -expiration_time = 3600 \ No newline at end of file +expiration_time = 3600