memcpy: fix bug in memcpy_s for cmocka

memcpy_s has wrong check condition for
overlapping sections. The copy from adjacent memory
bloks will result in dsp panic while it should be
allowed. This patch fixes the issue for cmocka
tests.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
This commit is contained in:
Marcin Rajwa 2019-06-18 16:06:22 +02:00 committed by Janusz Jankowski
parent c357561ec9
commit afbb2a6f53
1 changed files with 2 additions and 2 deletions

View File

@ -13,8 +13,8 @@ int memcpy_s(void *dest, size_t dest_size,
if (!dest || !src) if (!dest || !src)
return -EINVAL; return -EINVAL;
if ((dest + dest_size >= src && dest + dest_size <= src + src_size) || if ((dest >= src && dest < (src + src_size)) ||
(src + src_size >= dest && src + src_size <= dest + dest_size)) (src >= dest && src < (dest + dest_size)))
return -EINVAL; return -EINVAL;
if (src_size > dest_size) if (src_size > dest_size)