[Date Prev][Date Next]
Re: possible undefined behaviour in openldap-19981116
On Mon, Dec 07, 1998 at 23:07:12 +0100, Jorg Pietschmann wrote:
> there are quite some occurances where strcpy is applied to
> overlapping, source and desitnation, like this from slapd/config.c
> strcpy( next, next + 1 );
> I don't have the standard right in front of me but i vaguely remember
> that this may lead to undefined behaviour. In order to be on the
> sure side, a test might be added to configure whether this really
ISO/IEC 9899, i.e. the ISO (and ansi) C standard has the following
sentence in section 126.96.36.199 about strcpy:
"If copying takes place between objects that overlap, the
behavior is undefined."
Suggestion: use memmove instead.