gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: fix attestation flag rest; fix NULL ptr


From: gnunet
Subject: [gnunet] branch master updated: fix attestation flag rest; fix NULL ptr deref
Date: Tue, 03 Mar 2020 13:35:01 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new cd841b66b fix attestation flag rest; fix NULL ptr deref
cd841b66b is described below

commit cd841b66b685604a54030ead95b2d679325d5dd8
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Tue Mar 3 13:30:53 2020 +0100

    fix attestation flag rest; fix NULL ptr deref
---
 src/reclaim/plugin_rest_reclaim.c | 5 ++++-
 src/reclaim/reclaim_attribute.c   | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/reclaim/plugin_rest_reclaim.c 
b/src/reclaim/plugin_rest_reclaim.c
index f25241906..0246e289a 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -964,7 +964,10 @@ attr_collect (void *cls,
   json_object_set_new (attr_obj, "value", json_string (tmp_value));
   json_object_set_new (attr_obj, "name", json_string (attr->name));
 
-  json_object_set_new (attr_obj, "flag", json_string ("1"));
+  if (GNUNET_RECLAIM_id_is_zero (&attr->attestation))
+    json_object_set_new (attr_obj, "flag", json_string ("0"));
+  else
+    json_object_set_new (attr_obj, "flag", json_string ("1"));
   type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
   json_object_set_new (attr_obj, "type", json_string (type));
   id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id,
diff --git a/src/reclaim/reclaim_attribute.c b/src/reclaim/reclaim_attribute.c
index 12f124c15..69c5351d3 100644
--- a/src/reclaim/reclaim_attribute.c
+++ b/src/reclaim/reclaim_attribute.c
@@ -366,6 +366,13 @@ GNUNET_RECLAIM_attribute_list_deserialize (const char 
*data, size_t data_size)
     ale->attribute =
       GNUNET_RECLAIM_attribute_deserialize (read_ptr,
                                             data_size - (read_ptr - data));
+    if (NULL == ale->attribute)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Failed to deserialize malformed attribute.\n");
+      GNUNET_free (ale);
+      return al;
+    }
     GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale);
     attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (ale->attribute);
     read_ptr += attr_len;

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]