From adb028361a2e1c4c74ed52afb815ba8e185d5085 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Thu, 2 Jul 2015 00:30:59 +0200 Subject: [PATCH 1/2] ng_udp: fix documentation --- sys/include/net/ng_udp.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/include/net/ng_udp.h b/sys/include/net/ng_udp.h index 5908cb7e61..0caa8352ee 100644 --- a/sys/include/net/ng_udp.h +++ b/sys/include/net/ng_udp.h @@ -70,9 +70,9 @@ typedef struct __attribute__((packed)) { * @param[in] pseudo_hdr Pointer to the network layer header * * @return 0 on success - * @return -EBADMSG if @p pkt is not of type NG_NETTYPE_UDP - * @return -EFAULT if @p pkt or @p pseudo_hdr is NULL - * @return -ENOENT if @p pseudo_hdr_type is not known + * @return -EBADMSG if @p hdr is not of type NG_NETTYPE_UDP + * @return -EFAULT if @p hdr or @p pseudo_hdr is NULL + * @return -ENOENT if ng_pktsnip_t::type of @p pseudo_hdr is not known */ int ng_udp_calc_csum(ng_pktsnip_t *hdr, ng_pktsnip_t *pseudo_hdr); @@ -86,7 +86,8 @@ int ng_udp_calc_csum(ng_pktsnip_t *hdr, ng_pktsnip_t *pseudo_hdr); * @param[in] dst_len Length of @p dst, must be 2 * * @return pointer to the newly created (and allocated) header - * @return NULL on error + * @return NULL on `src == NULL`, `dst == NULL`, `src_len != 2`, `dst_len != 2` + * or on allocation error */ ng_pktsnip_t *ng_udp_hdr_build(ng_pktsnip_t *payload, uint8_t *src, size_t src_len, From 380c53c3e160297b3a3118437d9cfa8302dedbba Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Thu, 2 Jul 2015 00:32:18 +0200 Subject: [PATCH 2/2] ng_udp: fix NULL pointer check in ng_udp_calc_csum --- sys/net/transport_layer/ng_udp/ng_udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/transport_layer/ng_udp/ng_udp.c b/sys/net/transport_layer/ng_udp/ng_udp.c index 917fb33e8f..6787d9bd0c 100644 --- a/sys/net/transport_layer/ng_udp/ng_udp.c +++ b/sys/net/transport_layer/ng_udp/ng_udp.c @@ -208,7 +208,7 @@ int ng_udp_calc_csum(ng_pktsnip_t *hdr, ng_pktsnip_t *pseudo_hdr) { uint16_t csum; - if (hdr == NULL || hdr->next == NULL) { + if ((hdr == NULL) || (pseudo_hdr == NULL)) { return -EFAULT; } if (hdr->type != NG_NETTYPE_UDP) {