[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [patch #9288] Possible null-pointer dereference
From: |
Sergio R. Caprile |
Subject: |
[lwip-devel] [patch #9288] Possible null-pointer dereference |
Date: |
Wed, 22 Mar 2017 14:06:54 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:51.0) Gecko/20100101 Firefox/51.0 |
Follow-up Comment #2, patch #9288 (project lwip):
The possible null pointer was already caught by the assertion:
LWIP_ASSERT("recv_udp must have an argument", arg != NULL);
conn = (struct netconn *)arg;
+
+ if (conn == NULL) {
+ pbuf_free(p);
+ return;
+ }
+
conn is arg, and arg is checked for not NULL in the assertion;
so this added piece of code is a redundant check.
Then, the patch correctly removes unnecessary checks within the if's:
- if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox) ||
+ if (!sys_mbox_valid(&conn->recvmbox) ||
((recv_avail + (int)(p->tot_len)) > conn->recv_bufsize)) {
#else /* LWIP_SO_RCVBUF */
- if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox)) {
+ if (!sys_mbox_valid(&conn->recvmbox)) {
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/patch/?9288>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/