Skip to content

Commit 7343e0d

Browse files
daverigbytrondn
authored andcommitted
ep_test_apis.cc: Avoid undefined behaviour upon zero length set
It's undefined to pass a null pointer to memcpy(). Replace with std::copy. Change-Id: I5143bc0852f14d42ccf3f6199428f64e912ad3e1 Reviewed-on: http://review.couchbase.org/93765 Tested-by: Build Bot <[email protected]> Reviewed-by: Trond Norbye <[email protected]>
1 parent c0c1db1 commit 7343e0d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

engines/ep/tests/ep_test_apis.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ cb::EngineErrorItemPair storeCasVb11(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1,
10891089
}
10901090

10911091
cb_assert(info.value[0].iov_len == vlen);
1092-
memcpy(info.value[0].iov_base, value, vlen);
1092+
std::copy(value, value + vlen, reinterpret_cast<char*>(info.value[0].iov_base));
10931093
h1->item_set_cas(h, rv.second.get(), casIn);
10941094

10951095
bool create_cookie = false;

0 commit comments

Comments
 (0)