summaryrefslogtreecommitdiff
path: root/src/support/scratch.c
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-02-26 08:08:21 -0500
committerKeith Bostic <keith@wiredtiger.com>2014-02-26 08:09:49 -0500
commit27e5aeb968ae36a23f24995a466560297735afc8 (patch)
tree0d1cb6244caa6330ea75824eb9a9bb01ff8a10f1 /src/support/scratch.c
parent99305a5414b8140472cc45e2aec926da5c7a0046 (diff)
downloadmongo-27e5aeb968ae36a23f24995a466560297735afc8.tar.gz
Allow overlapping strings when setting a buffer's contents, it's not
insane __wt_buf_set might be used to shuffle strings in an existing WT_ITEM buffer. Reference #881, but this doesn't close it, we still want to understand why it can happen.
Diffstat (limited to 'src/support/scratch.c')
-rw-r--r--src/support/scratch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/support/scratch.c b/src/support/scratch.c
index 4b342977372..1aae8649901 100644
--- a/src/support/scratch.c
+++ b/src/support/scratch.c
@@ -127,7 +127,8 @@ __wt_buf_set(
/* Ensure the buffer is large enough. */
WT_RET(__wt_buf_initsize(session, buf, size));
- memcpy(buf->mem, data, size);
+ /* Copy, allowing for overlapping strings. */
+ memmove(buf->mem, data, size);
return (0);
}