comparison libpurple/circbuffer.c @ 25876:70df8067d41e

Backport 7829ec76bdb008583f8da54e238c2265a1140db2 (#8706 - Corruption in PurpleCircBuffer)
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 30 Apr 2009 05:19:41 +0000
parents 5f2496830fd4
children 01f1929d0936
comparison
equal deleted inserted replaced
25875:dfd7be3e3cb7 25876:70df8067d41e
66 buf->outptr = buf->buffer + out_offset; 66 buf->outptr = buf->buffer + out_offset;
67 } 67 }
68 68
69 /* If the fill pointer is wrapped to before the remove 69 /* If the fill pointer is wrapped to before the remove
70 * pointer, we need to shift the data */ 70 * pointer, we need to shift the data */
71 if (in_offset < out_offset) { 71 if (in_offset < out_offset
72 || (in_offset == out_offset && buf->bufused > 0)) {
72 int shift_n = MIN(buf->buflen - start_buflen, 73 int shift_n = MIN(buf->buflen - start_buflen,
73 in_offset); 74 in_offset);
74 memcpy(buf->buffer + start_buflen, buf->buffer, 75 memcpy(buf->buffer + start_buflen, buf->buffer,
75 shift_n); 76 shift_n);
76 77