gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: -fix hton length mismatch


From: gnunet
Subject: [gnunet] branch master updated: -fix hton length mismatch
Date: Sat, 05 Nov 2022 14:44:53 +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 4db7f94ce -fix hton length mismatch
4db7f94ce is described below

commit 4db7f94ce6c8d6aed2b834c050b983de42f98718
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Sat Nov 5 22:44:46 2022 +0900

    -fix hton length mismatch
---
 src/reclaim/reclaim_attribute.c  | 12 ++++++------
 src/reclaim/reclaim_credential.c | 20 ++++++++++----------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/reclaim/reclaim_attribute.c b/src/reclaim/reclaim_attribute.c
index b5c41b2d1..c107355f7 100644
--- a/src/reclaim/reclaim_attribute.c
+++ b/src/reclaim/reclaim_attribute.c
@@ -472,12 +472,12 @@ GNUNET_RECLAIM_attribute_serialize (
   char *write_ptr;
 
   attr_ser = (struct Attribute *) result;
-  attr_ser->attribute_type = htons (attr->type);
+  attr_ser->attribute_type = htonl (attr->type);
   attr_ser->attribute_flag = htonl (attr->flag);
   attr_ser->attribute_id = attr->id;
   attr_ser->credential_id = attr->credential;
   name_len = strlen (attr->name);
-  attr_ser->name_len = htons (name_len);
+  attr_ser->name_len = htonl (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 = htons (data_len_ser);
+  attr_ser->data_size = htonl (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 = ntohs (attr_ser->data_size);
-  name_len = ntohs (attr_ser->name_len);
+  data_len = ntohl (attr_ser->data_size);
+  name_len = ntohl (attr_ser->name_len);
   if (data_size < sizeof(struct Attribute) + data_len + name_len)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -524,7 +524,7 @@ GNUNET_RECLAIM_attribute_deserialize (const char *data, 
size_t data_size,
   }
   attribute = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attribute)
                         + data_len + name_len + 1);
-  attribute->type = ntohs (attr_ser->attribute_type);
+  attribute->type = ntohl (attr_ser->attribute_type);
   attribute->flag = ntohl (attr_ser->attribute_flag);
   attribute->id = attr_ser->attribute_id;
   attribute->credential = attr_ser->credential_id;
diff --git a/src/reclaim/reclaim_credential.c b/src/reclaim/reclaim_credential.c
index 6dc1a1fcf..c7eefc916 100644
--- a/src/reclaim/reclaim_credential.c
+++ b/src/reclaim/reclaim_credential.c
@@ -437,11 +437,11 @@ GNUNET_RECLAIM_credential_serialize (
   char *write_ptr;
 
   atts = (struct Credential *) result;
-  atts->credential_type = htons (credential->type);
+  atts->credential_type = htonl (credential->type);
   atts->credential_flag = htonl (credential->flag);
   atts->credential_id = credential->id;
   name_len = strlen (credential->name);
-  atts->name_len = htons (name_len);
+  atts->name_len = htonl (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 = htons (data_len_ser);
+  atts->data_size = htonl (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 = ntohs (atts->data_size);
-  name_len = ntohs (atts->name_len);
+  data_len = ntohl (atts->data_size);
+  name_len = ntohl (atts->name_len);
   if (data_size < sizeof(struct Credential) + data_len + name_len)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -488,7 +488,7 @@ GNUNET_RECLAIM_credential_deserialize (const char *data, 
size_t data_size)
   }
   credential = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Credential)
                               + data_len + name_len + 1);
-  credential->type = ntohs (atts->credential_type);
+  credential->type = ntohl (atts->credential_type);
   credential->flag = ntohl (atts->credential_flag);
   credential->id = atts->credential_id;
   credential->data_size = data_len;
@@ -856,11 +856,11 @@ GNUNET_RECLAIM_presentation_serialize (
   char *write_ptr;
 
   atts = (struct Presentation *) result;
-  atts->presentation_type = htons (presentation->type);
+  atts->presentation_type = htonl (presentation->type);
   atts->credential_id = presentation->credential_id;
   write_ptr = (char *) &atts[1];
   GNUNET_memcpy (write_ptr, presentation->data, presentation->data_size);
-  atts->data_size = htons (presentation->data_size);
+  atts->data_size = htonl (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 = ntohs (atts->data_size);
+  data_len = ntohl (atts->data_size);
   if (data_size < sizeof(struct Presentation) + data_len)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -895,7 +895,7 @@ GNUNET_RECLAIM_presentation_deserialize (const char *data, 
size_t data_size)
   }
   presentation = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
                                 + data_len);
-  presentation->type = ntohs (atts->presentation_type);
+  presentation->type = ntohl (atts->presentation_type);
   presentation->credential_id = atts->credential_id;
   presentation->data_size = data_len;
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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