From: Florian Schmidt Date: Mon, 18 Feb 2019 09:30:26 +0000 (+0100) Subject: uknetdev_output: Fix loop iterator X-Git-Tag: RELEASE-0.3~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=049738c2e59b5be15556d69edb003f2e64ba847b;p=unikraft%2Flibs%2Flwip.git uknetdev_output: Fix loop iterator Setting q to p->next leads to an infinite loop if p has at least two segments. The correct way is to iterate over q so we actually progress through the list. Signed-off-by: Florian Schmidt Reviewed-by: Simon Kuenzer --- diff --git a/uknetdev.c b/uknetdev.c index 34394fc..47d2fb1 100644 --- a/uknetdev.c +++ b/uknetdev.c @@ -142,7 +142,7 @@ static err_t uknetdev_output(struct netif *nf, struct pbuf *p) * yet. As long as we do not have this, we have to copy. */ wpos = nb->data; - for (q = p; q != NULL; q = p->next) { + for (q = p; q != NULL; q = q->next) { memcpy(wpos, q->payload, q->len); wpos += q->len; }