aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2020-03-03 13:30:53 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2020-03-03 13:30:53 +0100
commitcd841b66b685604a54030ead95b2d679325d5dd8 (patch)
tree12e536b26ac24fb8a042a8ad5dc14d9b2364ab82 /src
parentd1bdcb2618b13c3289492347550feb3fcf1f812d (diff)
downloadgnunet-cd841b66b685604a54030ead95b2d679325d5dd8.tar.gz
gnunet-cd841b66b685604a54030ead95b2d679325d5dd8.zip
fix attestation flag rest; fix NULL ptr deref
Diffstat (limited to 'src')
-rw-r--r--src/reclaim/plugin_rest_reclaim.c5
-rw-r--r--src/reclaim/reclaim_attribute.c7
2 files changed, 11 insertions, 1 deletions
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,
964 json_object_set_new (attr_obj, "value", json_string (tmp_value)); 964 json_object_set_new (attr_obj, "value", json_string (tmp_value));
965 json_object_set_new (attr_obj, "name", json_string (attr->name)); 965 json_object_set_new (attr_obj, "name", json_string (attr->name));
966 966
967 json_object_set_new (attr_obj, "flag", json_string ("1")); 967 if (GNUNET_RECLAIM_id_is_zero (&attr->attestation))
968 json_object_set_new (attr_obj, "flag", json_string ("0"));
969 else
970 json_object_set_new (attr_obj, "flag", json_string ("1"));
968 type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type); 971 type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
969 json_object_set_new (attr_obj, "type", json_string (type)); 972 json_object_set_new (attr_obj, "type", json_string (type));
970 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, 973 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)
366 ale->attribute = 366 ale->attribute =
367 GNUNET_RECLAIM_attribute_deserialize (read_ptr, 367 GNUNET_RECLAIM_attribute_deserialize (read_ptr,
368 data_size - (read_ptr - data)); 368 data_size - (read_ptr - data));
369 if (NULL == ale->attribute)
370 {
371 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
372 "Failed to deserialize malformed attribute.\n");
373 GNUNET_free (ale);
374 return al;
375 }
369 GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale); 376 GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale);
370 attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (ale->attribute); 377 attr_len = GNUNET_RECLAIM_attribute_serialize_get_size (ale->attribute);
371 read_ptr += attr_len; 378 read_ptr += attr_len;