Staging
v0.5.1
https://github.com/python/cpython
Revision b7180a89b352428db51e66f0082d4c01764dc534 authored by Matthias Klose on 17 October 2010, 10:48:14 UTC, committed by Matthias Klose on 17 October 2010, 10:48:14 UTC
  Issue #7673: Fix security vulnerability (CVE-2010-2089) in the audioop module,
  ensure that the input string length is a multiple of the frame size
1 parent d4367c2
Raw File
Tip revision: b7180a89b352428db51e66f0082d4c01764dc534 authored by Matthias Klose on 17 October 2010, 10:48:14 UTC
Merge r82494 from the python2.6 branch:
Tip revision: b7180a8
memmove.c

/* A perhaps slow but I hope correct implementation of memmove */

extern char *memcpy(char *, char *, int);

char *
memmove(char *dst, char *src, int n)
{
	char *realdst = dst;
	if (n <= 0)
		return dst;
	if (src >= dst+n || dst >= src+n)
		return memcpy(dst, src, n);
	if (src > dst) {
		while (--n >= 0)
			*dst++ = *src++;
	}
	else if (src < dst) {
		src += n;
		dst += n;
		while (--n >= 0)
			*--dst = *--src;
	}
	return realdst;
}
back to top