-/* $NetBSD: scores.c,v 1.13 2004/01/27 20:30:30 jsm Exp $ */
+/* $NetBSD: scores.c,v 1.14 2006/06/01 16:12:27 drochner Exp $ */
/*-
* Copyright (c) 1992, 1993
continue;
}
}
- levelfound[sp->hs_level] = 1;
+ if (sp->hs_level < NLEVELS && sp->hs_level >= 0)
+ levelfound[sp->hs_level] = 1;
i++, sp++;
}
return (num > MAXHISCORES ? MAXHISCORES : num);
for (i = MINLEVEL; i < NLEVELS; i++)
levelfound[i] = 0;
for (i = 0, sp = scores; i < nscores; i++, sp++) {
- if (levelfound[sp->hs_level])
- sp->hs_time = 0;
- else {
- sp->hs_time = 1;
- levelfound[sp->hs_level] = 1;
- }
+ if (sp->hs_level < NLEVELS && sp->hs_level >= 0) {
+ if (levelfound[sp->hs_level])
+ sp->hs_time = 0;
+ else {
+ sp->hs_time = 1;
+ levelfound[sp->hs_level] = 1;
+ }
+ }
}
/*
continue;
}
sp = &hs[item];
- (void)sprintf(buf,
+ (void)snprintf(buf, sizeof(buf),
"%3d%c %6d %-11s (%6d on %d)",
item + offset, sp->hs_time ? '*' : ' ',
sp->hs_score * sp->hs_level,