mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-28 18:16:13 +00:00
Fix pbuf_memcmp() implementation by using pbuf_try_get_at() instead of pbuf_get_at(). Payload out-of-bounds access was not handled correctly.
This commit is contained in:
parent
23147b0e21
commit
4325aca0f7
@ -1310,8 +1310,11 @@ pbuf_memcmp(struct pbuf* p, u16_t offset, const void* s2, u16_t n)
|
||||
if ((q != NULL) && (q->len > start)) {
|
||||
u16_t i;
|
||||
for (i = 0; i < n; i++) {
|
||||
u8_t a = pbuf_get_at(q, start + i);
|
||||
u8_t b = ((const u8_t*)s2)[i];
|
||||
int a = pbuf_try_get_at(q, start + i);
|
||||
if (a < 0) {
|
||||
return 0xffff;
|
||||
}
|
||||
if (a != b) {
|
||||
return i+1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user