diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-25 21:08:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-25 21:08:55 +0000 |
commit | 537903a8dc4c3ecf2dfa382af0289ddf890adfc7 (patch) | |
tree | 93e448c15c843861bd5dfe86c7cad3245abedfe7 /src/util/connection.c | |
parent | 2b61888a0bf1d41b2b25256ca9834c3040551ce9 (diff) | |
download | gnunet-537903a8dc4c3ecf2dfa382af0289ddf890adfc7.tar.gz gnunet-537903a8dc4c3ecf2dfa382af0289ddf890adfc7.zip |
fixing common off-by-one error with respect to maximum message size
Diffstat (limited to 'src/util/connection.c')
-rw-r--r-- | src/util/connection.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util/connection.c b/src/util/connection.c index 1631718e7..6c53bdef7 100644 --- a/src/util/connection.c +++ b/src/util/connection.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "gnunet_container_lib.h" | 37 | #include "gnunet_container_lib.h" |
38 | #include "gnunet_resolver_service.h" | 38 | #include "gnunet_resolver_service.h" |
39 | #include "gnunet_scheduler_lib.h" | 39 | #include "gnunet_scheduler_lib.h" |
40 | #include "gnunet_server_lib.h" | ||
40 | 41 | ||
41 | #define DEBUG_CONNECTION GNUNET_NO | 42 | #define DEBUG_CONNECTION GNUNET_NO |
42 | 43 | ||
@@ -326,6 +327,7 @@ GNUNET_CONNECTION_create_from_existing (struct GNUNET_SCHEDULER_Handle | |||
326 | struct GNUNET_CONNECTION_Handle *ret; | 327 | struct GNUNET_CONNECTION_Handle *ret; |
327 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf); | 328 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf); |
328 | ret->write_buffer = (char *) &ret[1]; | 329 | ret->write_buffer = (char *) &ret[1]; |
330 | GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
329 | ret->write_buffer_size = maxbuf; | 331 | ret->write_buffer_size = maxbuf; |
330 | ret->sock = osSocket; | 332 | ret->sock = osSocket; |
331 | ret->sched = sched; | 333 | ret->sched = sched; |
@@ -416,6 +418,7 @@ GNUNET_CONNECTION_create_from_accept (struct GNUNET_SCHEDULER_Handle | |||
416 | } | 418 | } |
417 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf); | 419 | ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf); |
418 | ret->write_buffer = (char *) &ret[1]; | 420 | ret->write_buffer = (char *) &ret[1]; |
421 | GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
419 | ret->write_buffer_size = maxbuf; | 422 | ret->write_buffer_size = maxbuf; |
420 | ret->addr = uaddr; | 423 | ret->addr = uaddr; |
421 | ret->addrlen = addrlen; | 424 | ret->addrlen = addrlen; |
@@ -873,6 +876,7 @@ GNUNET_CONNECTION_create_from_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
873 | ret->cfg = cfg; | 876 | ret->cfg = cfg; |
874 | ret->sched = sched; | 877 | ret->sched = sched; |
875 | ret->write_buffer = (char *) &ret[1]; | 878 | ret->write_buffer = (char *) &ret[1]; |
879 | GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
876 | ret->write_buffer_size = maxbuf; | 880 | ret->write_buffer_size = maxbuf; |
877 | ret->port = port; | 881 | ret->port = port; |
878 | ret->hostname = GNUNET_strdup (hostname); | 882 | ret->hostname = GNUNET_strdup (hostname); |
@@ -929,6 +933,7 @@ GNUNET_CONNECTION_create_from_connect_to_unixpath (struct GNUNET_SCHEDULER_Handl | |||
929 | ret->cfg = cfg; | 933 | ret->cfg = cfg; |
930 | ret->sched = sched; | 934 | ret->sched = sched; |
931 | ret->write_buffer = (char *) &ret[1]; | 935 | ret->write_buffer = (char *) &ret[1]; |
936 | GNUNET_assert (maxbuf < GNUNET_SERVER_MAX_MESSAGE_SIZE); | ||
932 | ret->write_buffer_size = maxbuf; | 937 | ret->write_buffer_size = maxbuf; |
933 | ret->port = 0; | 938 | ret->port = 0; |
934 | ret->hostname = NULL; | 939 | ret->hostname = NULL; |