api.h, api_lib.c, sockets.c: netbuf_ref doesn't check its internal pbuf_alloc call result and can cause a crash. lwip_send now check netbuf_ref result.
This commit is contained in:
@@ -484,12 +484,11 @@ lwip_send(int s, const void *data, int size, unsigned int flags)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* make the buffer point to the data that should
|
||||
be sent */
|
||||
netbuf_ref(buf, data, size);
|
||||
|
||||
/* send the data */
|
||||
err = netconn_send(sock->conn, buf);
|
||||
/* make the buffer point to the data that should be sent */
|
||||
if ((err = netbuf_ref(buf, data, size))==ERR_OK) {
|
||||
/* send the data */
|
||||
err = netconn_send(sock->conn, buf);
|
||||
}
|
||||
|
||||
/* deallocated the buffer */
|
||||
netbuf_delete(buf);
|
||||
|
||||
Reference in New Issue
Block a user