changeset 25591:70df8067d41e

Backport 7829ec76bdb008583f8da54e238c2265a1140db2 (#8706 - Corruption in PurpleCircBuffer)
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 30 Apr 2009 05:19:41 +0000
parents dfd7be3e3cb7
children bd18bb4915ba
files COPYRIGHT libpurple/circbuffer.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Thu Apr 30 05:18:04 2009 +0000
+++ b/COPYRIGHT	Thu Apr 30 05:19:41 2009 +0000
@@ -8,6 +8,7 @@
 Dave Ahlswede
 Manuel Amador
 Matt Amato
+Josef Andrysek
 Geoffrey Antos
 Daniel Atallah
 Paul Aurich
--- a/libpurple/circbuffer.c	Thu Apr 30 05:18:04 2009 +0000
+++ b/libpurple/circbuffer.c	Thu Apr 30 05:19:41 2009 +0000
@@ -68,7 +68,8 @@
 
 	/* If the fill pointer is wrapped to before the remove
 	 * pointer, we need to shift the data */
-	if (in_offset < out_offset) {
+	if (in_offset < out_offset
+			|| (in_offset == out_offset && buf->bufused > 0)) {
 		int shift_n = MIN(buf->buflen - start_buflen,
 			in_offset);
 		memcpy(buf->buffer + start_buflen, buf->buffer,