diff --git a/src/core/pbuf.c b/src/core/pbuf.c index bbc98460..aafa8e41 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -360,12 +360,12 @@ pbuf_header(struct pbuf *p, s16_t header_size_increment) if ((header_size_increment == 0) || (p == NULL)) return 0; - increment_magnitude = header_size_increment; - if (increment_magnitude < 0){ - increment_magnitude = -increment_magnitude; + if (header_size_increment < 0){ + increment_magnitude = -header_size_increment; /* Check that we aren't going to move off the end of the pbuf */ LWIP_ERROR("increment_magnitude > p->len", (increment_magnitude > p->len), return 1;); } else { + increment_magnitude = header_size_increment; #if 0 /* Can't assert these as some callers speculatively call pbuf_header() to see if it's OK. Will return 1 below instead. */