gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-twister] branch master updated: fix sizing


From: gnunet
Subject: [GNUnet-SVN] [taler-twister] branch master updated: fix sizing
Date: Fri, 14 Jun 2019 16:48:48 +0200

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

marcello pushed a commit to branch master
in repository twister.

The following commit(s) were added to refs/heads/master by this push:
     new da1ddbd  fix sizing
da1ddbd is described below

commit da1ddbdce6b5fd9ff6e14423390af08cc0acf9c2
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Jun 14 16:48:42 2019 +0200

    fix sizing
---
 src/twister/taler-twister-service.c | 10 ++++++----
 src/twister/twister_api.c           | 26 ++++++++++----------------
 2 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/src/twister/taler-twister-service.c 
b/src/twister/taler-twister-service.c
index dec8b0b..6ec1057 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -2600,10 +2600,12 @@ handle_flip_path_dl (void *cls,
   tailsize = ntohs (src->header.size) - sizeof (*src);
 
   GNUNET_assert
-    (tailsize == GNUNET_STRINGS_buffer_tokenize ((const char *) &src[1],
-                                                 tailsize,
-                                                 1,
-                                                 &flip_path_dl));
+    (tailsize == GNUNET_STRINGS_buffer_tokenize
+      ((const char *) &src[1],
+       tailsize,
+       1,
+       &flip_path_dl));
+
   send_acknowledgement (c);
 }
 
diff --git a/src/twister/twister_api.c b/src/twister/twister_api.c
index 330e6f1..978e7d1 100644
--- a/src/twister/twister_api.c
+++ b/src/twister/twister_api.c
@@ -324,7 +324,6 @@ TALER_TWISTER_flip_download
   struct GNUNET_MQ_Envelope *env;
   struct TWISTER_FlipPath *src; //FIXME 'src' right name?
   uint16_t stralloc;
-  uint16_t size;
 
   op = GNUNET_new (struct TALER_TWISTER_Operation);
   op->h = h;
@@ -334,14 +333,12 @@ TALER_TWISTER_flip_download
                                     h->op_tail,
                                     op);
   stralloc = strlen (path) + 1;
-  size = sizeof (*src) + stralloc;
 
-  GNUNET_assert (size < UINT16_MAX);
-  env = GNUNET_MQ_msg_extra
-    (src, size, TWISTER_MESSAGE_TYPE_FLIP_PATH_DL);
-
-
-  /* Put data into the envelope. */
+  GNUNET_assert
+    (stralloc + sizeof (struct TWISTER_FlipPath) < UINT16_MAX);
+  env = GNUNET_MQ_msg_extra (src,
+                             stralloc,
+                             TWISTER_MESSAGE_TYPE_FLIP_PATH_DL);
   GNUNET_assert
     (stralloc == GNUNET_STRINGS_buffer_fill ((char *) &src[1],
                                              stralloc,
@@ -375,7 +372,6 @@ TALER_TWISTER_flip_upload
   struct TALER_TWISTER_Operation *op;
   struct GNUNET_MQ_Envelope *env;
   struct TWISTER_FlipPath *src; //FIXME 'src' right name?
-  uint16_t size;
   uint16_t stralloc = strlen (path) + 1;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
@@ -390,18 +386,16 @@ TALER_TWISTER_flip_upload
                                     h->op_tail,
                                     op);
 
-  size = sizeof (*src) + stralloc;
-  GNUNET_assert (size < UINT16_MAX);
-  env = GNUNET_MQ_msg_extra
-    (src, size, TWISTER_MESSAGE_TYPE_FLIP_PATH_UL);
-
-  /* Put data into the envelope. */
+  GNUNET_assert
+    (stralloc + sizeof (struct TWISTER_FlipPath) < UINT16_MAX);
+  env = GNUNET_MQ_msg_extra (src,
+                             stralloc,
+                             TWISTER_MESSAGE_TYPE_FLIP_PATH_UL);
   GNUNET_assert
     (stralloc == GNUNET_STRINGS_buffer_fill ((char *) &src[1],
                                              stralloc,
                                              1,
                                              path));
-  /* Send message. */
   GNUNET_MQ_send (h->mq, env);
   return op;
 }

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



reply via email to

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