diff src/protocols/oscar/bstream.c @ 10595:de34037a02c7

[gaim-migrate @ 12010] Forward port some other stuff from oldstatus committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Feb 2005 03:07:06 +0000
parents 61ef9a964574
children 8d74ae785a46
line wrap: on
line diff
--- a/src/protocols/oscar/bstream.c	Mon Feb 14 03:02:36 2005 +0000
+++ b/src/protocols/oscar/bstream.c	Mon Feb 14 03:07:06 2005 +0000
@@ -49,10 +49,15 @@
 	return;
 }
 
+/*
+ * N can be negative, which can be used for going backwards
+ * in a bstream.  I'm not sure if libfaim actually does
+ * this anywhere...
+ */
 faim_internal int aim_bstream_advance(aim_bstream_t *bs, int n)
 {
 
-	if (aim_bstream_empty(bs) < n)
+	if ((aim_bstream_curpos(bs) + n < 0) || (aim_bstream_empty(bs) < n))
 		return 0; /* XXX throw an exception */
 
 	bs->offset += n;