mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-07 15:04:39 +08:00
Fixes bug #13807: slipif_input() garbles large (i.e. multiple pbufs) inbound datagrams.
This commit is contained in:
parent
baf377679a
commit
e11d57c883
@ -32,8 +32,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is an arch independent SLIP netif. The specific serial hooks must be provided
|
* This is an arch independent SLIP netif. The specific serial hooks must be
|
||||||
* by another file.They are sio_open, sio_recv and sio_send
|
* provided by another file. They are sio_open, sio_recv and sio_send
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "netif/slipif.h"
|
#include "netif/slipif.h"
|
||||||
@ -66,8 +66,8 @@ slipif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
|
|||||||
/* Send pbuf out on the serial I/O device. */
|
/* Send pbuf out on the serial I/O device. */
|
||||||
sio_send(SLIP_END, netif->state);
|
sio_send(SLIP_END, netif->state);
|
||||||
|
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for (q = p; q != NULL; q = q->next) {
|
||||||
for(i = 0; i < q->len; i++) {
|
for (i = 0; i < q->len; i++) {
|
||||||
c = ((u8_t *)q->payload)[i];
|
c = ((u8_t *)q->payload)[i];
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case SLIP_END:
|
case SLIP_END:
|
||||||
@ -96,7 +96,7 @@ slipif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
|
|||||||
* @return The IP packet when SLIP_END is received
|
* @return The IP packet when SLIP_END is received
|
||||||
*/
|
*/
|
||||||
static struct pbuf *
|
static struct pbuf *
|
||||||
slipif_input( struct netif * netif )
|
slipif_input(struct netif *netif)
|
||||||
{
|
{
|
||||||
u8_t c;
|
u8_t c;
|
||||||
struct pbuf *p, *q;
|
struct pbuf *p, *q;
|
||||||
@ -156,6 +156,9 @@ slipif_input( struct netif * netif )
|
|||||||
i++;
|
i++;
|
||||||
if (i >= p->len) {
|
if (i >= p->len) {
|
||||||
i = 0;
|
i = 0;
|
||||||
|
if (p->next != NULL && p->next->len > 0)
|
||||||
|
p = p->next;
|
||||||
|
else
|
||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user