diff options
Diffstat (limited to 'src/core/core_api.c')
-rw-r--r-- | src/core/core_api.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index 1a4b23333..d6cb68213 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -907,19 +907,18 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
907 | return; | 907 | return; |
908 | } | 908 | } |
909 | ntm = (const struct NotifyTrafficMessage *) msg; | 909 | ntm = (const struct NotifyTrafficMessage *) msg; |
910 | |||
911 | ats_count = ntohl (ntm->ats_count); | 910 | ats_count = ntohl (ntm->ats_count); |
912 | if ((msize < | 911 | if ((msize < |
913 | sizeof (struct NotifyTrafficMessage) + | 912 | sizeof (struct NotifyTrafficMessage) + |
914 | ats_count * sizeof (struct GNUNET_ATS_Information) + | 913 | ats_count * sizeof (struct GNUNET_ATS_Information) + |
915 | sizeof (struct GNUNET_MessageHeader)) || | 914 | sizeof (struct GNUNET_MessageHeader)) ) |
916 | (GNUNET_ATS_ARRAY_TERMINATOR != ntohl ((&ntm->ats)[ats_count].type))) | ||
917 | { | 915 | { |
918 | GNUNET_break (0); | 916 | GNUNET_break (0); |
919 | reconnect_later (h); | 917 | reconnect_later (h); |
920 | return; | 918 | return; |
921 | } | 919 | } |
922 | em = (const struct GNUNET_MessageHeader *) &(&ntm->ats)[ats_count + 1]; | 920 | ats = (const struct GNUNET_ATS_Information*) &ntm[1]; |
921 | em = (const struct GNUNET_MessageHeader *) &ats[ats_count]; | ||
923 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 922 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
924 | "Received message of type %u and size %u from peer `%4s'\n", | 923 | "Received message of type %u and size %u from peer `%4s'\n", |
925 | ntohs (em->type), ntohs (em->size), GNUNET_i2s (&ntm->peer)); | 924 | ntohs (em->type), ntohs (em->size), GNUNET_i2s (&ntm->peer)); |
@@ -954,7 +953,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
954 | return; | 953 | return; |
955 | } | 954 | } |
956 | if (GNUNET_OK != | 955 | if (GNUNET_OK != |
957 | h->handlers[hpos].callback (h->cls, &ntm->peer, em, &ntm->ats, | 956 | h->handlers[hpos].callback (h->cls, &ntm->peer, em, ats, |
958 | ats_count)) | 957 | ats_count)) |
959 | { | 958 | { |
960 | /* error in processing, do not process other messages! */ | 959 | /* error in processing, do not process other messages! */ |
@@ -962,7 +961,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
962 | } | 961 | } |
963 | } | 962 | } |
964 | if (NULL != h->inbound_notify) | 963 | if (NULL != h->inbound_notify) |
965 | h->inbound_notify (h->cls, &ntm->peer, em, &ntm->ats, ats_count); | 964 | h->inbound_notify (h->cls, &ntm->peer, em, ats, ats_count); |
966 | break; | 965 | break; |
967 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND: | 966 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND: |
968 | if (msize < sizeof (struct NotifyTrafficMessage)) | 967 | if (msize < sizeof (struct NotifyTrafficMessage)) |
@@ -982,14 +981,14 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
982 | if ((msize < | 981 | if ((msize < |
983 | sizeof (struct NotifyTrafficMessage) + | 982 | sizeof (struct NotifyTrafficMessage) + |
984 | ats_count * sizeof (struct GNUNET_ATS_Information) + | 983 | ats_count * sizeof (struct GNUNET_ATS_Information) + |
985 | sizeof (struct GNUNET_MessageHeader)) || | 984 | sizeof (struct GNUNET_MessageHeader)) ) |
986 | (GNUNET_ATS_ARRAY_TERMINATOR != ntohl ((&ntm->ats)[ats_count].type))) | ||
987 | { | 985 | { |
988 | GNUNET_break (0); | 986 | GNUNET_break (0); |
989 | reconnect_later (h); | 987 | reconnect_later (h); |
990 | return; | 988 | return; |
991 | } | 989 | } |
992 | em = (const struct GNUNET_MessageHeader *) &(&ntm->ats)[ats_count + 1]; | 990 | ats = (const struct GNUNET_ATS_Information*) &ntm[1]; |
991 | em = (const struct GNUNET_MessageHeader *) &ats[ats_count]; | ||
993 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 992 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
994 | "Received notification about transmission to `%s'.\n", | 993 | "Received notification about transmission to `%s'.\n", |
995 | GNUNET_i2s (&ntm->peer)); | 994 | GNUNET_i2s (&ntm->peer)); |
@@ -1007,7 +1006,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1007 | GNUNET_break (0); | 1006 | GNUNET_break (0); |
1008 | break; | 1007 | break; |
1009 | } | 1008 | } |
1010 | h->outbound_notify (h->cls, &ntm->peer, em, &ntm->ats, ats_count); | 1009 | h->outbound_notify (h->cls, &ntm->peer, em, ats, ats_count); |
1011 | break; | 1010 | break; |
1012 | case GNUNET_MESSAGE_TYPE_CORE_SEND_READY: | 1011 | case GNUNET_MESSAGE_TYPE_CORE_SEND_READY: |
1013 | if (msize != sizeof (struct SendMessageReady)) | 1012 | if (msize != sizeof (struct SendMessageReady)) |