aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-25 21:08:55 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-25 21:08:55 +0000
commit537903a8dc4c3ecf2dfa382af0289ddf890adfc7 (patch)
tree93e448c15c843861bd5dfe86c7cad3245abedfe7 /src/fs
parent2b61888a0bf1d41b2b25256ca9834c3040551ce9 (diff)
downloadgnunet-537903a8dc4c3ecf2dfa382af0289ddf890adfc7.tar.gz
gnunet-537903a8dc4c3ecf2dfa382af0289ddf890adfc7.zip
fixing common off-by-one error with respect to maximum message size
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_publish.c2
-rw-r--r--src/fs/gnunet-service-fs_indexing.c5
2 files changed, 3 insertions, 4 deletions
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 2ebb96169..13701405e 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -761,7 +761,7 @@ hash_for_index_cb (void *cls,
761 fn = GNUNET_STRINGS_filename_expand (p->filename); 761 fn = GNUNET_STRINGS_filename_expand (p->filename);
762 GNUNET_assert (fn != NULL); 762 GNUNET_assert (fn != NULL);
763 slen = strlen (fn) + 1; 763 slen = strlen (fn) + 1;
764 if (slen > GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct IndexStartMessage)) 764 if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof(struct IndexStartMessage))
765 { 765 {
766 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 766 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
767 _("Can not index file `%s': %s. Will try to insert instead.\n"), 767 _("Can not index file `%s': %s. Will try to insert instead.\n"),
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c
index d6654bcdc..b72c53fc0 100644
--- a/src/fs/gnunet-service-fs_indexing.c
+++ b/src/fs/gnunet-service-fs_indexing.c
@@ -430,7 +430,7 @@ GNUNET_FS_handle_index_list_get (void *cls,
430{ 430{
431 struct GNUNET_SERVER_TransmitContext *tc; 431 struct GNUNET_SERVER_TransmitContext *tc;
432 struct IndexInfoMessage *iim; 432 struct IndexInfoMessage *iim;
433 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE]; 433 char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1];
434 size_t slen; 434 size_t slen;
435 const char *fn; 435 const char *fn;
436 struct IndexInfo *pos; 436 struct IndexInfo *pos;
@@ -442,8 +442,7 @@ GNUNET_FS_handle_index_list_get (void *cls,
442 { 442 {
443 fn = pos->filename; 443 fn = pos->filename;
444 slen = strlen (fn) + 1; 444 slen = strlen (fn) + 1;
445 if (slen + sizeof (struct IndexInfoMessage) > 445 if (slen + sizeof (struct IndexInfoMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
446 GNUNET_SERVER_MAX_MESSAGE_SIZE)
447 { 446 {
448 GNUNET_break (0); 447 GNUNET_break (0);
449 break; 448 break;