mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 23:15:37 +00:00
Add missing null checks.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
parent
e61b925709
commit
6ac21515ca
@ -500,6 +500,9 @@ void
|
|||||||
netif_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr)
|
netif_set_ipaddr(struct netif *netif, const ip4_addr_t *ipaddr)
|
||||||
{
|
{
|
||||||
ip_addr_t old_addr;
|
ip_addr_t old_addr;
|
||||||
|
|
||||||
|
LWIP_ERROR("netif_set_ipaddr: invalid netif", netif != NULL, return);
|
||||||
|
|
||||||
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
|
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
|
||||||
if (ipaddr == NULL) {
|
if (ipaddr == NULL) {
|
||||||
ipaddr = IP4_ADDR_ANY4;
|
ipaddr = IP4_ADDR_ANY4;
|
||||||
@ -564,6 +567,8 @@ netif_set_netmask(struct netif *netif, const ip4_addr_t *netmask)
|
|||||||
#endif
|
#endif
|
||||||
LWIP_ASSERT_CORE_LOCKED();
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
|
LWIP_ERROR("netif_set_netmask: invalid netif", netif != NULL, return);
|
||||||
|
|
||||||
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
|
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
|
||||||
if (netmask == NULL) {
|
if (netmask == NULL) {
|
||||||
netmask = IP4_ADDR_ANY4;
|
netmask = IP4_ADDR_ANY4;
|
||||||
@ -623,6 +628,8 @@ netif_set_gw(struct netif *netif, const ip4_addr_t *gw)
|
|||||||
#endif
|
#endif
|
||||||
LWIP_ASSERT_CORE_LOCKED();
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
|
LWIP_ERROR("netif_set_gw: invalid netif", netif != NULL, return);
|
||||||
|
|
||||||
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
|
/* Don't propagate NULL pointer (IPv4 ANY) to subsequent functions */
|
||||||
if (gw == NULL) {
|
if (gw == NULL) {
|
||||||
gw = IP4_ADDR_ANY4;
|
gw = IP4_ADDR_ANY4;
|
||||||
|
@ -1218,6 +1218,8 @@ tcp_build_sack_option(const struct tcp_pcb *pcb, u32_t *opts, u8_t num_sacks)
|
|||||||
static void
|
static void
|
||||||
tcp_build_wnd_scale_option(u32_t *opts)
|
tcp_build_wnd_scale_option(u32_t *opts)
|
||||||
{
|
{
|
||||||
|
LWIP_ASSERT("tcp_build_wnd_scale_option: invalid opts", opts != NULL);
|
||||||
|
|
||||||
/* Pad with one NOP option to make everything nicely aligned */
|
/* Pad with one NOP option to make everything nicely aligned */
|
||||||
opts[0] = PP_HTONL(0x01030300 | TCP_RCV_SCALE);
|
opts[0] = PP_HTONL(0x01030300 | TCP_RCV_SCALE);
|
||||||
}
|
}
|
||||||
@ -1818,7 +1820,11 @@ tcp_output_alloc_header_common(u32_t ackno, u16_t optlen, u16_t datalen,
|
|||||||
u16_t src_port, u16_t dst_port, u8_t flags, u16_t wnd)
|
u16_t src_port, u16_t dst_port, u8_t flags, u16_t wnd)
|
||||||
{
|
{
|
||||||
struct tcp_hdr *tcphdr;
|
struct tcp_hdr *tcphdr;
|
||||||
struct pbuf *p = pbuf_alloc(PBUF_IP, TCP_HLEN + optlen + datalen, PBUF_RAM);
|
struct pbuf *p;
|
||||||
|
|
||||||
|
LWIP_ASSERT("tcp_output_alloc_header: invalid pcb", pcb != NULL);
|
||||||
|
|
||||||
|
p = pbuf_alloc(PBUF_IP, TCP_HLEN + optlen + datalen, PBUF_RAM);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
LWIP_ASSERT("check that first pbuf can hold struct tcp_hdr",
|
LWIP_ASSERT("check that first pbuf can hold struct tcp_hdr",
|
||||||
(p->len >= TCP_HLEN + optlen));
|
(p->len >= TCP_HLEN + optlen));
|
||||||
|
Loading…
Reference in New Issue
Block a user