diff src/buddy.c @ 2281:cc462108c101

[gaim-migrate @ 2291] hopefully this should fix a couple things... committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 13 Sep 2001 23:42:44 +0000
parents f7bf34a3b535
children bd9d403fb15b
line wrap: on
line diff
--- a/src/buddy.c	Thu Sep 13 22:57:53 2001 +0000
+++ b/src/buddy.c	Thu Sep 13 23:42:44 2001 +0000
@@ -2991,12 +2991,11 @@
 					gc->permdeny = 1;
 			}
 		} while ((c = strtok(NULL, "\n")));
-#if 0
-		fprintf(stdout, "Sending message '%s'\n", buf);
-#endif
-
-		if (bud != NULL)
+
+		if (bud != NULL) {
 			serv_add_buddies(gc, bud);
+			g_list_free(bud);
+		}
 		serv_set_permit_deny(gc);
 	}
 
@@ -3025,11 +3024,11 @@
 		gc->permdeny = 1;
 
 	pos += g_snprintf(&s[pos], len - pos, "m %d\n", gc->permdeny);
-	while (grp) {
+	while (len > pos && grp) {
 		g = (struct group *)grp->data;
 		pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name);
 		mem = g->members;
-		while (mem) {
+		while (len > pos && mem) {
 			b = (struct buddy *)mem->data;
 			pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name,
 					  (show && strcmp(b->name, b->show)) ? ":" : "",
@@ -3039,12 +3038,12 @@
 		grp = g_slist_next(grp);
 	}
 
-	while (plist) {
+	while (len > pos && plist) {
 		pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data);
 		plist = plist->next;
 	}
 
-	while (dlist) {
+	while (len > pos && dlist) {
 		pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data);
 		dlist = dlist->next;
 	}