From ddd4d10b26cfca1af5aebf50f2653546de29548f Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Wed, 18 May 2022 18:36:08 -0700
Subject: [PATCH] Fix loop limit (system.stats.total_users != system.lastuser)

When looping to highest user number, use system.lastuser, not
system.stats.total_users.

This explains why not all userbases would be affected by the just-fixed
issue in js_user.c. If the total_users happens to equal lastuser, then
you would have hit the issue in js_user.c. If you had at least one
deleted or inactive user account, then system.stats.total_users would
be less than system.lastuser and your system would *not* have triggered
that bug.
---
 exec/load/birthdays.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exec/load/birthdays.js b/exec/load/birthdays.js
index 0d541ed381..f7d7037132 100644
--- a/exec/load/birthdays.js
+++ b/exec/load/birthdays.js
@@ -16,7 +16,7 @@ load("sbbsdefs.js");
 function birthdays(month, day)
 {
 	var u = new User;
-	var lastuser = system.stats.total_users;
+	var lastuser = system.lastuser;
 	var list = [];
 	month = parseInt(month, 10) + 1;
 	for(u.number = 1; u.number <= lastuser; u.number++) {
-- 
GitLab