fixing common off-by-one error with respect to maximum message size
[oweals/gnunet.git] / src / fs / fs_publish.c
index d693fe6ee76bf765ec935df1ff169cb0283780c6..13701405ec7f4fa224c0342c0e22a275accde33e 100644 (file)
@@ -85,7 +85,7 @@ GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
                                const struct GNUNET_FS_FileInformation *p,
                                uint64_t offset)
 {
-  pi->value.publish.sc = sc;
+  pi->value.publish.pc = sc;
   pi->value.publish.fi = p;
   pi->value.publish.cctx
     = p->client_info;
@@ -308,7 +308,7 @@ publish_kblocks_cont (void *cls,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                  "Error uploading KSK blocks: %s\n",
                  emsg);
-#end
+#endif
       signal_publish_error (p, pc, emsg);
       GNUNET_FS_file_information_sync_ (p);
       GNUNET_FS_publish_sync_ (pc);
@@ -421,7 +421,7 @@ encode_cont (void *cls,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                  "Error during tree walk: %s\n",
                  emsg);
-#end
+#endif
       GNUNET_asprintf (&p->emsg, 
                       _("Upload failed: %s"),
                       emsg);
@@ -761,7 +761,7 @@ hash_for_index_cb (void *cls,
   fn = GNUNET_STRINGS_filename_expand (p->filename);
   GNUNET_assert (fn != NULL);
   slen = strlen (fn) + 1;
-  if (slen > GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct IndexStartMessage))
+  if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct IndexStartMessage))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                  _("Can not index file `%s': %s.  Will try to insert instead.\n"),