fixing 1584
[oweals/gnunet.git] / src / fs / gnunet-service-fs_indexing.c
index 630a78b101f6ac14c8376552e197f90fbf70fd59..833169792f5ef8c0ba7ef2e706384d114bdede66 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -36,7 +36,6 @@
 #include "gnunet_protocols.h"
 #include "gnunet_signatures.h"
 #include "gnunet_util_lib.h"
-#include "gnunet-service-fs_drq.h"
 #include "gnunet-service-fs_indexing.h"
 #include "fs.h"
 
@@ -342,9 +341,9 @@ GNUNET_FS_handle_index_start (void *cls,
   uint16_t msize;
   struct IndexInfo *ii;
   size_t slen;
-  uint32_t dev;
+  uint64_t dev;
   uint64_t ino;
-  uint32_t mydev;
+  uint64_t mydev;
   uint64_t myino;
 
   msize = ntohs(message->size);
@@ -358,7 +357,13 @@ GNUNET_FS_handle_index_start (void *cls,
     }
   ism = (const struct IndexStartMessage*) message;
   fn = GNUNET_STRINGS_filename_expand ((const char*) &ism[1]);
-  dev = ntohl (ism->device);
+  if (fn == NULL)
+    {
+      GNUNET_SERVER_receive_done (client,
+                                 GNUNET_SYSERR);
+      return;
+    }
+  dev = GNUNET_ntohll (ism->device);
   ino = GNUNET_ntohll (ism->inode);
   ism = (const struct IndexStartMessage*) message;
   slen = strlen (fn) + 1;
@@ -424,7 +429,7 @@ GNUNET_FS_handle_index_list_get (void *cls,
 {
   struct GNUNET_SERVER_TransmitContext *tc;
   struct IndexInfoMessage *iim;
-  char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
+  char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
   size_t slen;
   const char *fn;
   struct IndexInfo *pos;
@@ -436,8 +441,7 @@ GNUNET_FS_handle_index_list_get (void *cls,
     {
       fn = pos->filename;
       slen = strlen (fn) + 1;
-      if (slen + sizeof (struct IndexInfoMessage) > 
-         GNUNET_SERVER_MAX_MESSAGE_SIZE)
+      if (slen + sizeof (struct IndexInfoMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
        {
          GNUNET_break (0);
          break;