Commit 65e93897 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Fix User.number increment beyond lastuser issue

When the 'number' property of an instance of User was incremented beyond the last user, the call to fgetuserdat() on subsequent property 'get' operation would fail and zero-out the user structure (including the user number). This resulted in an infinite loop in load/birthdays.js where the user number would go from lastuser to 1 in one operation (u.number++).

Reported by DesotoFireflite (VALHALLA)
parent 94ea4bf4
Pipeline #3046 passed with stage
in 9 minutes and 31 seconds
......@@ -123,8 +123,10 @@ static void js_getuserdat(scfg_t* scfg, private_t* p)
if(p->user->number != 0 && !p->cached) {
if(p->file < 1)
p->file = openuserdat(scfg, /* for_modify: */FALSE);
ushort usernumber = p->user->number;
if(fgetuserdat(scfg, p->user, p->file)==0)
p->cached=TRUE;
p->user->number = usernumber; // Can be zeroed by fgetuserdat() failure
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment