Bug 3432 - memmove() does not conform with the C99 standard.
Summary: memmove() does not conform with the C99 standard.
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 minor
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-29 09:36 UTC by Yuval Fledel
Modified: 2016-05-08 14:16 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuval Fledel 2006-10-29 09:36:34 UTC
By reviewing the glibc sources it turns out that memmove() only does word copy.
Thus, the function will not work correctly when |dst-src|<|word|.

The C99 standard (section 7.21.2.2 "The memmove function") mandates:
---
#include <string.h>
void *memmove(void *s1, const void *s2, size_t n);

The memmove function copies n characters from the object pointed to by
s2 into the object pointed to by s1. Copying takes place as if the n
characters from the object pointed to by s2 are first copied into a
temporary array of n characters that does not overlap the objects
pointed to by s1 and s2, and then the n characters from the temporary
array are copied into the object pointed to by s1.
---
Comment 1 Ulrich Drepper 2006-10-29 18:42:32 UTC
Nonsense, memmove takes the buffer location into account on all the supported
architectures.  I don't know what file you're looking at.