This commit typecasts `src` and `dst` strings from `memmove()` to ensure
that their values are treated as pointers.
It also modifies the function implementation to handle overlapping.
Co-authored-by: Soumya Ranjan <ranjan42069@gmail.com>
Signed-off-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Signed-off-by: Soumya Ranjan <ranjan42069@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #880
uint8_t *d = dst;
const uint8_t *s = src;
- if (src > dst) {
+ if ((intptr_t)src == (intptr_t)dst) {
+ return dst;
+ } else if ((intptr_t)src > (intptr_t)dst) {
for (; len > 0; --len)
*(d++) = *(s++);
} else {
uint8_t *d = dst;
const uint8_t *s = src;
- if (src > dst) {
+ if ((intptr_t)src == (intptr_t)dst) {
+ return dst;
+ } else if ((intptr_t)src > (intptr_t)dst) {
for (; len > 0; --len)
*(d++) = *(s++);
} else {