gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34217 - gnunet/src/peerstore


From: gnunet
Subject: [GNUnet-SVN] r34217 - gnunet/src/peerstore
Date: Sun, 24 Aug 2014 20:29:41 +0200

Author: otarabai
Date: 2014-08-24 20:29:41 +0200 (Sun, 24 Aug 2014)
New Revision: 34217

Modified:
   gnunet/src/peerstore/peerstore.conf.in
   gnunet/src/peerstore/peerstore.h
   gnunet/src/peerstore/peerstore_common.c
Log:
peerstore: minor fixes


Modified: gnunet/src/peerstore/peerstore.conf.in
===================================================================
--- gnunet/src/peerstore/peerstore.conf.in      2014-08-24 17:58:02 UTC (rev 
34216)
+++ gnunet/src/peerstore/peerstore.conf.in      2014-08-24 18:29:41 UTC (rev 
34217)
@@ -1,6 +1,7 @@
 [peerstore]
 AUTOSTART = @AUTOSTART@
address@hidden@PORT = 2110
address@hidden@PORT = 2110
+HOSTNAME = localhost
 BINARY = gnunet-service-peerstore
 UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-peerstore.sock
 UNIX_MATCH_UID = NO

Modified: gnunet/src/peerstore/peerstore.h
===================================================================
--- gnunet/src/peerstore/peerstore.h    2014-08-24 17:58:02 UTC (rev 34216)
+++ gnunet/src/peerstore/peerstore.h    2014-08-24 18:29:41 UTC (rev 34217)
@@ -44,7 +44,7 @@
   /**
    * #GNUNET_YES if peer id value set, #GNUNET_NO otherwise
    */
-  uint16_t peer_set;
+  uint16_t peer_set GNUNET_PACKED;
 
   /**
    * Peer Identity
@@ -55,30 +55,30 @@
    * Size of the sub_system string
    * Allocated at position 0 after this struct
    */
-  size_t sub_system_size;
+  uint16_t sub_system_size GNUNET_PACKED;
 
   /**
    * Size of the key string
    * Allocated at position 1 after this struct
    */
-  size_t key_size;
+  uint16_t key_size GNUNET_PACKED;
 
   /**
    * Size of value blob
    * Allocated at position 2 after this struct
    */
-  size_t value_size;
+  uint16_t value_size GNUNET_PACKED;
 
   /**
    * Expiry time of entry
    */
-  struct GNUNET_TIME_Absolute expiry;
+  struct GNUNET_TIME_Absolute expiry GNUNET_PACKED;
 
   /**
    * Options, needed only in case of a
    * store operation
    */
-  enum GNUNET_PEERSTORE_StoreOption options;
+  enum GNUNET_PEERSTORE_StoreOption options GNUNET_PACKED;
 
 };
 

Modified: gnunet/src/peerstore/peerstore_common.c
===================================================================
--- gnunet/src/peerstore/peerstore_common.c     2014-08-24 17:58:02 UTC (rev 
34216)
+++ gnunet/src/peerstore/peerstore_common.c     2014-08-24 18:29:41 UTC (rev 
34217)
@@ -194,14 +194,25 @@
 
   req_size = ntohs (message->size);
   if (req_size < sizeof (struct StoreRecordMessage))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+             "Received message with invalid size: (%d < %d).\n",
+             req_size, sizeof (struct StoreRecordMessage));
     return NULL;
+  }
   srm = (struct StoreRecordMessage *) message;
   ss_size = ntohs (srm->sub_system_size);
   key_size = ntohs (srm->key_size);
   value_size = ntohs (srm->value_size);
   if (ss_size + key_size + value_size + sizeof (struct StoreRecordMessage) !=
       req_size)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+         "Received message with invalid sizes: (%d + %d + %d + %d != %d).\n",
+         ss_size, key_size, value_size, sizeof (struct StoreRecordMessage),
+         req_size);
     return NULL;
+  }
   record = GNUNET_new (struct GNUNET_PEERSTORE_Record);
   if (GNUNET_YES == ntohs (srm->peer_set))
   {




reply via email to

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