aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim-attribute/reclaim_attribute.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-06-03 21:22:50 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-06-03 21:22:50 +0200
commita00a49bf58c502ab860adaa6b01541c0e7e3e645 (patch)
treee9ece2ebffd1d0df735763fe5ebdfb2d334a496f /src/reclaim-attribute/reclaim_attribute.c
parent34c8bfb80b82a1a7f7d3db3c41e705b09a1fad7e (diff)
downloadgnunet-a00a49bf58c502ab860adaa6b01541c0e7e3e645.tar.gz
gnunet-a00a49bf58c502ab860adaa6b01541c0e7e3e645.zip
RECLAIM: Various fixes (coverity)
Diffstat (limited to 'src/reclaim-attribute/reclaim_attribute.c')
-rw-r--r--src/reclaim-attribute/reclaim_attribute.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/reclaim-attribute/reclaim_attribute.c b/src/reclaim-attribute/reclaim_attribute.c
index b9465bef7..96e61d431 100644
--- a/src/reclaim-attribute/reclaim_attribute.c
+++ b/src/reclaim-attribute/reclaim_attribute.c
@@ -495,12 +495,18 @@ GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, size_t data_size)
495 attr_ser = (struct Attribute *) data; 495 attr_ser = (struct Attribute *) data;
496 data_len = ntohs (attr_ser->data_size); 496 data_len = ntohs (attr_ser->data_size);
497 name_len = ntohs (attr_ser->name_len); 497 name_len = ntohs (attr_ser->name_len);
498 if (data_size < sizeof (struct Attribute) + data_len + name_len)
499 {
500 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
501 "Buffer too small to deserialize\n");
502 return NULL;
503 }
498 attr = GNUNET_malloc (sizeof (struct GNUNET_RECLAIM_ATTRIBUTE_Claim) + 504 attr = GNUNET_malloc (sizeof (struct GNUNET_RECLAIM_ATTRIBUTE_Claim) +
499 data_len + name_len + 1); 505 data_len + name_len + 1);
500 attr->type = ntohs (attr_ser->attribute_type); 506 attr->type = ntohs (attr_ser->attribute_type);
501 attr->version = ntohl (attr_ser->attribute_version); 507 attr->version = ntohl (attr_ser->attribute_version);
502 attr->id = GNUNET_ntohll (attr_ser->attribute_id); 508 attr->id = GNUNET_ntohll (attr_ser->attribute_id);
503 attr->data_size = ntohs (attr_ser->data_size); 509 attr->data_size = data_len;
504 510
505 write_ptr = (char *) &attr[1]; 511 write_ptr = (char *) &attr[1];
506 GNUNET_memcpy (write_ptr, &attr_ser[1], name_len); 512 GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);