Skip to content

Commit 10d9784

Browse files
[SYCL][NFC] Fix a C string size bug in buffer location unit test (#7060)
Increase the size returned by redefinedDeviceGetInfo by one to leave space for the null terminator.
1 parent 33594db commit 10d9784

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sycl/unittests/buffer/BufferLocation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ static pi_result redefinedDeviceGetInfo(pi_device device,
5959
if (param_name == PI_DEVICE_INFO_EXTENSIONS) {
6060
const std::string name = "cl_intel_mem_alloc_buffer_location";
6161
if (!param_value) {
62-
*param_value_size_ret = name.size();
62+
// Increase size by one for the null terminator
63+
*param_value_size_ret = name.size() + 1;
6364
} else {
6465
char *dst = static_cast<char *>(param_value);
6566
strcpy(dst, name.data());

0 commit comments

Comments
 (0)