[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[patch] fix an infinite loop in CAD_u.c



more for the specwebbers: depending on your requested connections you
might hit this infinite loop.  (it's bizarre how i was able to get so much
done before tripping this loop!  i didn't go and derive just when a userid
can end up with a last_ad of 0.)

-dean

--- CAD_u.c	2001/03/01 21:41:26	1.2
+++ CAD_u.c	2001/03/01 21:42:26
@@ -291,8 +291,11 @@
 	if ((user_id < 0) || (user_id > max_userid))
 		return -1;
 	for (adid = last_ad + 1; adid != last_ad; adid++) {
-		if (adid >= MAX_CUSTOM_ADS)
+		if (adid >= MAX_CUSTOM_ADS) {
 			adid = 0;
+			if (last_ad == 0)
+				break;
+		}

 		dem = (user_dem)[user_id].dem & ad[adid].dem;
 		weight = 0;





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []