gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: HOSTLIST: Fix hello message pointer size


From: gnunet
Subject: [gnunet] branch master updated: HOSTLIST: Fix hello message pointer size use
Date: Fri, 06 Oct 2023 11:19:24 +0200

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 0ae9184bc HOSTLIST: Fix hello message pointer size use
0ae9184bc is described below

commit 0ae9184bcdff6c756a25454b56c4699ba000f3cb
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Fri Oct 6 11:19:18 2023 +0200

    HOSTLIST: Fix hello message pointer size use
---
 src/hostlist/gnunet-daemon-hostlist_client.c | 72 +++++++++++-----------------
 src/hostlist/gnunet-daemon-hostlist_server.c |  2 +-
 2 files changed, 28 insertions(+), 46 deletions(-)

diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c 
b/src/hostlist/gnunet-daemon-hostlist_client.c
index 2932df07c..0fd16370f 100644
--- a/src/hostlist/gnunet-daemon-hostlist_client.c
+++ b/src/hostlist/gnunet-daemon-hostlist_client.c
@@ -48,19 +48,19 @@
  * Time interval hostlists are saved to disk
  */
 #define SAVING_INTERVAL \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30)
+        GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30)
 
 /**
  * Time interval between two hostlist tests
  */
 #define TESTING_INTERVAL \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
+        GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
 
 /**
  * Time interval for download dispatcher before a download is re-scheduled
  */
 #define WAITING_INTERVAL \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
+        GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
 
 /**
  * Defines concerning the hostlist quality metric
@@ -385,37 +385,19 @@ callback_download (void *ptr, size_t size, size_t nmemb, 
void *ctx)
       GNUNET_assert (left == 0);
       break;
     }
-    if (sizeof (msg) == msize)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Received valid `%s' message from hostlist server.\n",
-                  "HELLO");
-      GNUNET_STATISTICS_update (
-        stats,
-        gettext_noop ("# valid HELLOs downloaded from hostlist servers"),
-        1,
-        GNUNET_NO);
-      stat_hellos_obtained++;
-      shc = GNUNET_PEERSTORE_hello_add (peerstore,
-                                        msg,
-                                        shc_cont,
-                                        shc);
-    }
-    else
-    {
-      GNUNET_STATISTICS_update (
-        stats,
-        gettext_noop ("# invalid HELLOs downloaded from hostlist servers"),
-        1,
-        GNUNET_NO);
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  _ ("Invalid `%s' message received from hostlist at `%s'\n"),
-                  "HELLO",
-                  current_url);
-      stat_bogus_url = GNUNET_YES;
-      stat_hellos_obtained++;
-      return total;
-    }
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Received valid `%s' message from hostlist server.\n",
+                "HELLO");
+    GNUNET_STATISTICS_update (
+      stats,
+      gettext_noop ("# valid HELLOs downloaded from hostlist servers"),
+      1,
+      GNUNET_NO);
+    stat_hellos_obtained++;
+    shc = GNUNET_PEERSTORE_hello_add (peerstore,
+                                      msg,
+                                      shc_cont,
+                                      shc);
     memmove (download_buffer, &download_buffer[msize], download_pos - msize);
     download_pos -= msize;
   }
@@ -542,17 +524,17 @@ download_get_url ()
 
 
 #define CURL_EASY_SETOPT(c, a, b)                   \
-  do                                                \
-  {                                                 \
-    ret = curl_easy_setopt (c, a, b);               \
-    if (CURLE_OK != ret)                            \
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,        \
-                _ ("%s failed at %s:%d: `%s'\n"), \
-                "curl_easy_setopt",               \
-                __FILE__,                         \
-                __LINE__,                         \
-                curl_easy_strerror (ret));        \
-  } while (0)
+        do                                                \
+        {                                                 \
+          ret = curl_easy_setopt (c, a, b);               \
+          if (CURLE_OK != ret)                            \
+          GNUNET_log (GNUNET_ERROR_TYPE_WARNING,        \
+                      _ ("%s failed at %s:%d: `%s'\n"), \
+                      "curl_easy_setopt",               \
+                      __FILE__,                         \
+                      __LINE__,                         \
+                      curl_easy_strerror (ret));        \
+        } while (0)
 
 
 /**
diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c 
b/src/hostlist/gnunet-daemon-hostlist_server.c
index f383ec394..54db95009 100644
--- a/src/hostlist/gnunet-daemon-hostlist_server.c
+++ b/src/hostlist/gnunet-daemon-hostlist_server.c
@@ -240,7 +240,7 @@ host_processor (void *cls,
     }
   }
   old = builder->size;
-  s = sizeof (hello);
+  s = ntohs (hello->size);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received %u bytes of `%s' from peer `%s' for hostlist.\n",
               (unsigned int) s,

-- 
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]