Skip to content

Commit 175cce1

Browse files
committed
tests/nrf: Use memcpy instead of strncpy to avoid gcc warnings
While strncpy will work here, this isn't testing strings, it's testing byte arrays, so use memcpy Signed-off-by: Keith Packard <[email protected]>
1 parent 8453386 commit 175cce1

File tree

1 file changed

+1
-1
lines changed
  • tests/boards/nrf/i2c/i2c_slave/src

1 file changed

+1
-1
lines changed

tests/boards/nrf/i2c/i2c_slave/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ ZTEST_USER_F(i2c_api_twis, test_i2c_read_write)
125125
ZTEST_USER_F(i2c_api_twis, test_i2c_read)
126126
{
127127
/* Prepare slave data */
128-
strncpy(fixture->slave_buffer, msg, TEST_DATA_SIZE);
128+
memcpy(fixture->slave_buffer, msg, TEST_DATA_SIZE);
129129
zassert_mem_equal(fixture->slave_buffer, msg, TEST_DATA_SIZE);
130130

131131
int ret = i2c_read(fixture->dev, fixture->master_buffer, TEST_DATA_SIZE, fixture->addr);

0 commit comments

Comments
 (0)