fix mem corruption
authorSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>
Tue, 10 Apr 2018 11:20:05 +0000 (13:20 +0200)
committerSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>
Tue, 10 Apr 2018 11:20:05 +0000 (13:20 +0200)
src/identity-attribute/identity_attribute.c
src/identity-provider/gnunet-service-identity-provider.c
src/identity-provider/test_idp.conf

index 0111668feba6ee58949aa07104dc58f15679cf5b..dc2753fcab9c5a88113f585ff8711fdbbbc6c102 100644 (file)
@@ -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);
index a518d00aed64c3ba75ede33e24eda17ddaf113d0..b738ffc82ab192a87a50efcb83ab2fc63c4d2dcd 100644 (file)
@@ -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);
index b11b43ae274dd54645343fa28002fa16ce57c9d7..5480e497534dc1887e9ba5a0f0795942f96e9465 100644 (file)
@@ -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