fixed bug #39356 Wrong increment in pbuf_memfind()

This commit is contained in:
Simon Goldschmidt 2014-02-25 22:34:27 +01:00
parent dceed2ea5c
commit e9908048ec
2 changed files with 4 additions and 3 deletions

View File

@ -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()

View File

@ -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;
}
}
}