gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: handle corrupted names in c


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: handle corrupted names in cache
Date: Sun, 24 Jun 2018 23:20:02 +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 67233f623 handle corrupted names in cache
67233f623 is described below

commit 67233f623f8695a1e545aeebae0f9cb2df5dc84f
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Sun Jun 24 23:19:58 2018 +0200

    handle corrupted names in cache
---
 src/namecache/gnunet-service-namecache.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/namecache/gnunet-service-namecache.c 
b/src/namecache/gnunet-service-namecache.c
index cda1267e8..9130ed0a4 100644
--- a/src/namecache/gnunet-service-namecache.c
+++ b/src/namecache/gnunet-service-namecache.c
@@ -148,7 +148,11 @@ struct LookupBlockContext
    * Operation id for the name lookup
    */
   uint32_t request_id;
-
+  
+  /**
+   * Lookup status
+   */
+  uint32_t status;
 };
 
 
@@ -166,7 +170,17 @@ handle_lookup_block_it (void *cls,
   struct GNUNET_MQ_Envelope *env;
   struct LookupBlockResponseMessage *r;
   size_t esize;
+  size_t bsize;
 
+  bsize = ntohl (block->purpose.size);
+  if (bsize < 
+      (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct 
GNUNET_TIME_AbsoluteNBO)))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Malformed block.");
+    lnc->status = GNUNET_SYSERR;
+    return;
+  }
   esize = ntohl (block->purpose.size)
     - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)
     - sizeof (struct GNUNET_TIME_AbsoluteNBO);
@@ -209,6 +223,7 @@ handle_lookup_block (void *cls,
 
   lnc.request_id = ntohl (ln_msg->gns_header.r_id);
   lnc.nc = nc;
+  lnc.status = GNUNET_OK;
   if (GNUNET_SYSERR ==
       (ret = GSN_database->lookup_block (GSN_database->cls,
                                         &ln_msg->query,
@@ -222,7 +237,7 @@ handle_lookup_block (void *cls,
     GNUNET_SERVICE_client_drop (nc->client);
     return;
   }
-  if (0 == ret)
+  if ((0 == ret) || (GNUNET_SYSERR == lnc.status))
   {
     /* no records match at all, generate empty response */
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,

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



reply via email to

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