Merge pull request #9721 from smlng/pr/gnrc_udp/assert

gnrc_udp: assert ports not zero
This commit is contained in:
Martine Lenders 2018-08-06 16:59:55 +02:00 committed by GitHub
commit ad173831db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -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);

View File

@ -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;