diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-01-09 18:04:27 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-01-09 18:04:27 +0000 |
commit | e3fa79f963ecb116c549720531684d81e22a6ba1 (patch) | |
tree | 3ce6dff85187be927f29bb72cbb74e031507d65f /src/cadet | |
parent | fa92f3290023c93a5503730558b13d60d5ebd2f8 (diff) | |
download | gnunet-e3fa79f963ecb116c549720531684d81e22a6ba1.tar.gz gnunet-e3fa79f963ecb116c549720531684d81e22a6ba1.zip |
- add size argument to allow to verify message size
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.c | 10 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.h | 9 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index bb9fa6060..3cba96df3 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c | |||
@@ -1714,20 +1714,20 @@ GCCH_handle_local_ack (struct CadetChannel *ch, int fwd) | |||
1714 | * | 1714 | * |
1715 | * @param ch Channel. | 1715 | * @param ch Channel. |
1716 | * @param c Client which sent the data. | 1716 | * @param c Client which sent the data. |
1717 | * @param message Message. | ||
1718 | * @param fwd Is this a FWD data? | 1717 | * @param fwd Is this a FWD data? |
1718 | * @param message Data message. | ||
1719 | * @param size Size of data. | ||
1719 | * | 1720 | * |
1720 | * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. | 1721 | * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. |
1721 | */ | 1722 | */ |
1722 | int | 1723 | int |
1723 | GCCH_handle_local_data (struct CadetChannel *ch, | 1724 | GCCH_handle_local_data (struct CadetChannel *ch, |
1724 | struct CadetClient *c, | 1725 | struct CadetClient *c, int fwd, |
1725 | struct GNUNET_MessageHeader *message, | 1726 | const struct GNUNET_MessageHeader *message, |
1726 | int fwd) | 1727 | size_t size) |
1727 | { | 1728 | { |
1728 | struct CadetChannelReliability *rel; | 1729 | struct CadetChannelReliability *rel; |
1729 | struct GNUNET_CADET_Data *payload; | 1730 | struct GNUNET_CADET_Data *payload; |
1730 | size_t size = ntohs (message->size); | ||
1731 | uint16_t p2p_size = sizeof(struct GNUNET_CADET_Data) + size; | 1731 | uint16_t p2p_size = sizeof(struct GNUNET_CADET_Data) + size; |
1732 | unsigned char cbuf[p2p_size]; | 1732 | unsigned char cbuf[p2p_size]; |
1733 | 1733 | ||
diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h index c96958cf9..fb71b95be 100644 --- a/src/cadet/gnunet-service-cadet_channel.h +++ b/src/cadet/gnunet-service-cadet_channel.h | |||
@@ -184,16 +184,17 @@ GCCH_handle_local_ack (struct CadetChannel *ch, int fwd); | |||
184 | * | 184 | * |
185 | * @param ch Channel. | 185 | * @param ch Channel. |
186 | * @param c Client which sent the data. | 186 | * @param c Client which sent the data. |
187 | * @param message Message. | ||
188 | * @param fwd Is this a FWD data? | 187 | * @param fwd Is this a FWD data? |
188 | * @param message Data message. | ||
189 | * @param size Size of data. | ||
189 | * | 190 | * |
190 | * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. | 191 | * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. |
191 | */ | 192 | */ |
192 | int | 193 | int |
193 | GCCH_handle_local_data (struct CadetChannel *ch, | 194 | GCCH_handle_local_data (struct CadetChannel *ch, |
194 | struct CadetClient *c, | 195 | struct CadetClient *c, int fwd, |
195 | struct GNUNET_MessageHeader *message, | 196 | const struct GNUNET_MessageHeader *message, |
196 | int fwd); | 197 | size_t size); |
197 | 198 | ||
198 | /** | 199 | /** |
199 | * Handle a channel destroy requested by a client. | 200 | * Handle a channel destroy requested by a client. |