Browse Source

[libc] Avoid implicit assumptions about potentially-optimised memcpy()

Do not assume that an architecture-specific optimised memcpy() will
have the same properties as generic_memcpy() in terms of handling
overlapping regions.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
a966570dce
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      src/core/string.c

+ 1
- 1
src/core/string.c View File

81
 	uint8_t *dest_bytes = ( dest + len );
81
 	uint8_t *dest_bytes = ( dest + len );
82
 
82
 
83
 	if ( dest < src )
83
 	if ( dest < src )
84
-		return memcpy ( dest, src, len );
84
+		return generic_memcpy ( dest, src, len );
85
 	while ( len-- )
85
 	while ( len-- )
86
 		*(--dest_bytes) = *(--src_bytes);
86
 		*(--dest_bytes) = *(--src_bytes);
87
 	return dest;
87
 	return dest;

Loading…
Cancel
Save