[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -more size
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -more size |
Date: |
Sun, 06 Nov 2022 14:38:19 +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 a117a9eb8 -more size
a117a9eb8 is described below
commit a117a9eb8926dd5b566bcf8a5c605939490f851f
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Sun Nov 6 22:38:13 2022 +0900
-more size
---
src/reclaim/reclaim_attribute.c | 8 ++++----
src/reclaim/reclaim_attribute.h | 14 ++++++++++++--
src/reclaim/reclaim_credential.c | 12 ++++++------
src/reclaim/reclaim_credential.h | 14 ++++++++++++--
4 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/src/reclaim/reclaim_attribute.c b/src/reclaim/reclaim_attribute.c
index c107355f7..b235ed945 100644
--- a/src/reclaim/reclaim_attribute.c
+++ b/src/reclaim/reclaim_attribute.c
@@ -477,7 +477,7 @@ GNUNET_RECLAIM_attribute_serialize (
attr_ser->attribute_id = attr->id;
attr_ser->credential_id = attr->credential;
name_len = strlen (attr->name);
- attr_ser->name_len = htonl (name_len);
+ attr_ser->name_len = htons (name_len);
write_ptr = (char *) &attr_ser[1];
GNUNET_memcpy (write_ptr, attr->name, name_len);
write_ptr += name_len;
@@ -486,7 +486,7 @@ GNUNET_RECLAIM_attribute_serialize (
// &attr_ser[1]);
data_len_ser = attr->data_size;
GNUNET_memcpy (write_ptr, attr->data, attr->data_size);
- attr_ser->data_size = htonl (data_len_ser);
+ attr_ser->data_size = htons (data_len_ser);
return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
}
@@ -514,8 +514,8 @@ GNUNET_RECLAIM_attribute_deserialize (const char *data,
size_t data_size,
return -1;
attr_ser = (struct Attribute *) data;
- data_len = ntohl (attr_ser->data_size);
- name_len = ntohl (attr_ser->name_len);
+ data_len = ntohs (attr_ser->data_size);
+ name_len = ntohs (attr_ser->name_len);
if (data_size < sizeof(struct Attribute) + data_len + name_len)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/reclaim/reclaim_attribute.h b/src/reclaim/reclaim_attribute.h
index 285d75d83..44d85e61c 100644
--- a/src/reclaim/reclaim_attribute.h
+++ b/src/reclaim/reclaim_attribute.h
@@ -55,15 +55,25 @@ struct Attribute
*/
struct GNUNET_RECLAIM_Identifier credential_id;
+ /**
+ * Reserved (alignment)
+ */
+ uint16_t reserved_nl GNUNET_PACKED;
+
/**
* Name length
*/
- uint32_t name_len GNUNET_PACKED;
+ uint16_t name_len GNUNET_PACKED;
+
+ /**
+ * Reserved (alignment)
+ */
+ uint16_t reserved_ds GNUNET_PACKED;
/**
* Data size
*/
- uint32_t data_size GNUNET_PACKED;
+ uint16_t data_size GNUNET_PACKED;
// followed by data_size Attribute value data
};
diff --git a/src/reclaim/reclaim_credential.c b/src/reclaim/reclaim_credential.c
index c7eefc916..1aad261a1 100644
--- a/src/reclaim/reclaim_credential.c
+++ b/src/reclaim/reclaim_credential.c
@@ -441,7 +441,7 @@ GNUNET_RECLAIM_credential_serialize (
atts->credential_flag = htonl (credential->flag);
atts->credential_id = credential->id;
name_len = strlen (credential->name);
- atts->name_len = htonl (name_len);
+ atts->name_len = htons (name_len);
write_ptr = (char *) &atts[1];
GNUNET_memcpy (write_ptr, credential->name, name_len);
write_ptr += name_len;
@@ -450,7 +450,7 @@ GNUNET_RECLAIM_credential_serialize (
// &attr_ser[1]);
data_len_ser = credential->data_size;
GNUNET_memcpy (write_ptr, credential->data, credential->data_size);
- atts->data_size = htonl (data_len_ser);
+ atts->data_size = htons (data_len_ser);
return sizeof(struct Credential) + strlen (credential->name)
+ credential->data_size;
@@ -478,8 +478,8 @@ GNUNET_RECLAIM_credential_deserialize (const char *data,
size_t data_size)
return NULL;
atts = (struct Credential *) data;
- data_len = ntohl (atts->data_size);
- name_len = ntohl (atts->name_len);
+ data_len = ntohs (atts->data_size);
+ name_len = ntohs (atts->name_len);
if (data_size < sizeof(struct Credential) + data_len + name_len)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -860,7 +860,7 @@ GNUNET_RECLAIM_presentation_serialize (
atts->credential_id = presentation->credential_id;
write_ptr = (char *) &atts[1];
GNUNET_memcpy (write_ptr, presentation->data, presentation->data_size);
- atts->data_size = htonl (presentation->data_size);
+ atts->data_size = htons (presentation->data_size);
return sizeof(struct Presentation) + presentation->data_size;
}
@@ -886,7 +886,7 @@ GNUNET_RECLAIM_presentation_deserialize (const char *data,
size_t data_size)
return NULL;
atts = (struct Presentation *) data;
- data_len = ntohl (atts->data_size);
+ data_len = ntohs (atts->data_size);
if (data_size < sizeof(struct Presentation) + data_len)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/reclaim/reclaim_credential.h b/src/reclaim/reclaim_credential.h
index 7704ed968..ba91ab8f8 100644
--- a/src/reclaim/reclaim_credential.h
+++ b/src/reclaim/reclaim_credential.h
@@ -82,15 +82,25 @@ struct Presentation
*/
struct GNUNET_RECLAIM_Identifier credential_id;
+ /**
+ * Reserved (alignment)
+ */
+ uint16_t reserved_nl GNUNET_PACKED;
+
/**
* Name length
*/
- uint32_t name_len;
+ uint16_t name_len GNUNET_PACKED;
+
+ /**
+ * Reserved (alignment)
+ */
+ uint16_t reserved_ds GNUNET_PACKED;
/**
* Data size
*/
- uint32_t data_size;
+ uint16_t data_size GNUNET_PACKED;
// followed by data_size Presentation value data
};
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -more size,
gnunet <=