ofpbuf: Fix arithmetic error in ofpbuf_insert().
memmove byte count was calculated incorrectly as ofpbuf_put_uninit
is increasing b->size by n.
This patch fixes it by reducing byte count by n.
Reported-at:
@@ -469,9 +469,9 @@ void
ofpbuf_insert(struct ofpbuf *b, size_t offset, const void *data, size_t n)
{
if (offset < b->size) {
- ofpbuf_put_uninit(b, n);
+ ofpbuf_put_uninit(b, n); /* b->size gets increased. */
memmove((char *) b->data + offset + n, (char *) b->data + offset,
- b->size - offset);
+ b->size - offset - n);
memcpy((char *) b->data + offset, data, n);
} else {
ovs_assert(offset == b->size);
