mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
test: unicode: fix a sizeof() vs ARRAY_SIZE() bug
The u16_strlcat() is in units of u16 not bytes. So the limit needs to be ARRAY_SIZE() instead of sizeof(). Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
This commit is contained in:
parent
bb34bc0c96
commit
be5f9a77f8
1 changed files with 3 additions and 3 deletions
|
@ -807,12 +807,12 @@ static int unicode_test_u16_strlcat(struct unit_test_state *uts)
|
|||
|
||||
/* dest and src are empty string */
|
||||
memset(buf, 0, sizeof(buf));
|
||||
ret = u16_strlcat(buf, &null_src, sizeof(buf));
|
||||
ret = u16_strlcat(buf, &null_src, ARRAY_SIZE(buf));
|
||||
ut_asserteq(0, ret);
|
||||
|
||||
/* dest is empty string */
|
||||
memset(buf, 0, sizeof(buf));
|
||||
ret = u16_strlcat(buf, src, sizeof(buf));
|
||||
ret = u16_strlcat(buf, src, ARRAY_SIZE(buf));
|
||||
ut_asserteq(4, ret);
|
||||
ut_assert(!unicode_test_u16_strcmp(buf, src, 40));
|
||||
|
||||
|
@ -820,7 +820,7 @@ static int unicode_test_u16_strlcat(struct unit_test_state *uts)
|
|||
memset(buf, 0xCD, (sizeof(buf) - sizeof(u16)));
|
||||
buf[39] = 0;
|
||||
memcpy(buf, dest, sizeof(dest));
|
||||
ret = u16_strlcat(buf, &null_src, sizeof(buf));
|
||||
ret = u16_strlcat(buf, &null_src, ARRAY_SIZE(buf));
|
||||
ut_asserteq(5, ret);
|
||||
ut_assert(!unicode_test_u16_strcmp(buf, dest, 40));
|
||||
|
||||
|
|
Loading…
Reference in a new issue