Commits (1)
  • Rob Swindell's avatar
    Fix User.number increment beyond lastuser issue · 65e93897
    Rob Swindell authored
    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)
......@@ -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->user->number = usernumber; // Can be zeroed by fgetuserdat() failure