summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-12-01 11:59:33 +0100
committerOle Trøan <otroan@employees.org>2016-12-02 14:15:02 +0000
commitdce0545441cec7242f3eacc8b163c521395f4c3e (patch)
tree3b3d8c91c9acac3bcc0a022c163764e122edc05a
parent152e21dda61d07c8f736affaf1f844daa4cc199c (diff)
buffers: fix vlib_buffer_copy
memcpy should happen after current_data is set. Change-Id: I838f61b54d15a8bb55d54f770f47fb4d58d071cb Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--vlib/vlib/buffer_funcs.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/vlib/vlib/buffer_funcs.h b/vlib/vlib/buffer_funcs.h
index 60e0e28d625..cfe568e32e9 100644
--- a/vlib/vlib/buffer_funcs.h
+++ b/vlib/vlib/buffer_funcs.h
@@ -426,14 +426,14 @@ vlib_buffer_copy (vlib_main_t * vm, vlib_buffer_t * b)
/* 1st segment */
s = b;
fd = d = vlib_get_buffer (vm, new_buffers[0]);
- clib_memcpy (vlib_buffer_get_current (d),
- vlib_buffer_get_current (s), s->current_length);
d->current_data = s->current_data;
d->current_length = s->current_length;
d->flags = s->flags & flag_mask;
d->total_length_not_including_first_buffer =
s->total_length_not_including_first_buffer;
clib_memcpy (d->opaque, s->opaque, sizeof (s->opaque));
+ clib_memcpy (vlib_buffer_get_current (d),
+ vlib_buffer_get_current (s), s->current_length);
/* next segments */
for (i = 1; i < n_buffers; i++)