From 81c3a87ee5018104b76afe4c9d6c2b848f0acdaf Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 17 Nov 2017 23:38:39 -0800 Subject: [PATCH] ircd::buffer: Fix bug. --- include/ircd/buffer.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/ircd/buffer.h b/include/ircd/buffer.h index 9cf8d2a13..7ebc47456 100644 --- a/include/ircd/buffer.h +++ b/include/ircd/buffer.h @@ -572,8 +572,9 @@ ircd::buffer::copy(it &dest, { const it ret{dest}; const size_t remain(stop - dest); - dest += std::min(size(src), remain); - memcpy(ret, data(src), dest - ret); + const size_t cpsz{std::min(size(src), remain)}; + memcpy(ret, data(src), cpsz); + dest += cpsz; return ret; }