Skip to content

Commit

Permalink
Merge pull request #9721 from smlng/pr/gnrc_udp/assert
Browse files Browse the repository at this point in the history
gnrc_udp: assert ports not zero
  • Loading branch information
miri64 committed Aug 6, 2018
2 parents 65db050 + fd718df commit ad17383
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sys/include/net/gnrc/udp.h
Expand Up @@ -76,6 +76,8 @@ int gnrc_udp_calc_csum(gnrc_pktsnip_t *hdr, gnrc_pktsnip_t *pseudo_hdr);
* @return pointer to the newly created (and allocated) header
* @return NULL on `src == NULL`, `dst == NULL`, `src_len != 2`, `dst_len != 2`
* or on allocation error
*
* @pre `src > 0` and `dst > 0`
*/
gnrc_pktsnip_t *gnrc_udp_hdr_build(gnrc_pktsnip_t *payload, uint16_t src,
uint16_t dst);
Expand Down
2 changes: 2 additions & 0 deletions sys/net/gnrc/transport_layer/udp/gnrc_udp.c
Expand Up @@ -280,6 +280,8 @@ int gnrc_udp_calc_csum(gnrc_pktsnip_t *hdr, gnrc_pktsnip_t *pseudo_hdr)
gnrc_pktsnip_t *gnrc_udp_hdr_build(gnrc_pktsnip_t *payload, uint16_t src,
uint16_t dst)
{
assert((src > 0) && (dst > 0));

gnrc_pktsnip_t *res;
udp_hdr_t *hdr;

Expand Down

0 comments on commit ad17383

Please sign in to comment.