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: First moves towards


From: gnunet
Subject: [GNUnet-SVN] [taler-twister] branch master updated: First moves towards #5744.
Date: Thu, 13 Jun 2019 19:42:27 +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 5918da2  First moves towards #5744.
5918da2 is described below

commit 5918da2557bcc14b20689181244e268e31918adf
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Jun 13 19:42:10 2019 +0200

    First moves towards #5744.
---
 src/twister/twister.h     |  5 -----
 src/twister/twister_api.c | 35 ++++++++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/src/twister/twister.h b/src/twister/twister.h
index b22101c..8c6c044 100644
--- a/src/twister/twister.h
+++ b/src/twister/twister.h
@@ -104,11 +104,6 @@ struct TWISTER_FlipPath
    * Type: #TWISTER_MESSAGE_TYPE_DELETE_PATH
    */
   struct GNUNET_MessageHeader header;
-
-  /**
-   * The new response code, in big endian.
-   */
-  char path[TWISTER_PATH_LENGTH];
 };
 
 GNUNET_NETWORK_STRUCT_END
diff --git a/src/twister/twister_api.c b/src/twister/twister_api.c
index 182ee7f..ca93de0 100644
--- a/src/twister/twister_api.c
+++ b/src/twister/twister_api.c
@@ -323,6 +323,8 @@ TALER_TWISTER_flip_download
   struct TALER_TWISTER_Operation *op;
   struct GNUNET_MQ_Envelope *env;
   struct TWISTER_FlipPath *src; //FIXME 'src' right name?
+  size_t stralloc;
+  size_t size;
 
   op = GNUNET_new (struct TALER_TWISTER_Operation);
   op->h = h;
@@ -331,12 +333,18 @@ TALER_TWISTER_flip_download
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
                                     h->op_tail,
                                     op);
-  /* Prepare *env*elope. */
-  env = GNUNET_MQ_msg
-    (src, TWISTER_MESSAGE_TYPE_FLIP_PATH_DL);
+  stralloc = strlen (path) + 1;
+  size = sizeof (*src) + stralloc;
+  env = GNUNET_MQ_msg_extra
+    (src, size, TWISTER_MESSAGE_TYPE_FLIP_PATH_DL);
+
+
   /* Put data into the envelope. */
-  strcpy (src->path, path);
-  /* Send message. */
+  GNUNET_assert
+    (stralloc == GNUNET_STRINGS_buffer_fill ((char *) &src[1],
+                                             stralloc,
+                                             1,
+                                             path));
   GNUNET_MQ_send (h->mq, env);
   return op;
 }
@@ -365,6 +373,8 @@ TALER_TWISTER_flip_upload
   struct TALER_TWISTER_Operation *op;
   struct GNUNET_MQ_Envelope *env;
   struct TWISTER_FlipPath *src; //FIXME 'src' right name?
+  size_t size;
+  size_t stralloc = strlen (path) + 1;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
               "Will UL-flip: %s\n",
@@ -377,11 +387,18 @@ TALER_TWISTER_flip_upload
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
                                     h->op_tail,
                                     op);
-  /* Prepare *env*elope. */
-  env = GNUNET_MQ_msg
-    (src, TWISTER_MESSAGE_TYPE_FLIP_PATH_UL);
+
+  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. */
-  strcpy (src->path, path);
+  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]