changeset 26277:bcbc5994d21c

Josef Andrysek noticed that there's a scenario where the PurpleCircBuffer gets corrupted and supplied a patch to fix it. Fixes #8706
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 20 Mar 2009 02:42:38 +0000
parents c884b702ec17
children 399776a9ad98 e1b91b7b5f69
files COPYRIGHT libpurple/circbuffer.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Wed Mar 18 19:30:16 2009 +0000
+++ b/COPYRIGHT	Fri Mar 20 02:42:38 2009 +0000
@@ -8,6 +8,7 @@
 Dave Ahlswede
 Manuel Amador
 Matt Amato
+Josef Andrysek
 Geoffrey Antos
 Daniel Atallah
 Paul Aurich
--- a/libpurple/circbuffer.c	Wed Mar 18 19:30:16 2009 +0000
+++ b/libpurple/circbuffer.c	Fri Mar 20 02:42:38 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,