From e9908048ecb2970ef757e291cb47cc036182b999 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Tue, 25 Feb 2014 22:34:27 +0100 Subject: [PATCH] fixed bug #39356 Wrong increment in pbuf_memfind() --- CHANGELOG | 3 +++ src/core/pbuf.c | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 808d34f0..d36d686d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -96,6 +96,9 @@ HISTORY ++ Bugfixes: + 2014-02-25: Simon Goldschmidt, patch by Fatih Asici + * pbuf.c: fixed bug #39356 Wrong increment in pbuf_memfind() + 2014-02-25: Simon Goldschmidt * netif.c/.h, udp.c: fixed bug #39225 udp.c uses netif_matches_ip6_addr() incorrectly; renamed function netif_matches_ip6_addr() to netif_get_ip6_addr_match() diff --git a/src/core/pbuf.c b/src/core/pbuf.c index 0e5981bd..27130455 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -1192,12 +1192,10 @@ pbuf_memfind(struct pbuf* p, const void* mem, u16_t mem_len, u16_t start_offset) u16_t i; u16_t max = p->tot_len - mem_len; if (p->tot_len >= mem_len + start_offset) { - for(i = start_offset; i <= max; ) { + for(i = start_offset; i <= max; i++) { u16_t plus = pbuf_memcmp(p, i, mem, mem_len); if (plus == 0) { return i; - } else { - i += plus; } } }