fix NULL ptr deref in attestations
authorSchanzenbach, Martin <mschanzenbach@posteo.de>
Tue, 3 Mar 2020 12:32:31 +0000 (13:32 +0100)
committerSchanzenbach, Martin <mschanzenbach@posteo.de>
Tue, 3 Mar 2020 12:32:31 +0000 (13:32 +0100)
src/reclaim/reclaim_attestation.c

index 66da8e74a6b73f2eefb98ec7dc02a9fd2241e677..bdf80a7096415d2e24ea97d344be8a19a5f369a9 100644 (file)
@@ -336,6 +336,13 @@ GNUNET_RECLAIM_attestation_list_deserialize (const char *data, size_t data_size)
     ale->attestation =
       GNUNET_RECLAIM_attestation_deserialize (read_ptr,
                                               data_size - (read_ptr - data));
+    if (NULL == ale->attestation)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Failed to deserialize malformed attestation.\n");
+      GNUNET_free (ale);
+      return al;
+    }
     GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale);
     att_len = GNUNET_RECLAIM_attestation_serialize_get_size (ale->attestation);
     read_ptr += att_len;