summaryrefslogtreecommitdiff
path: root/games/atc
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>2001-02-04 13:06:21 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>2001-02-04 13:06:21 +0000
commitaa0c20ead364992f6964cb350d66a40f7c5018e9 (patch)
tree5f2e38d4381af3f6f69695ba1312b39f829aa58b /games/atc
parentecfa21621996251ce86b6a655e6840d7919f8911 (diff)
Be a little more careful with scanf() on the score file
Diffstat (limited to 'games/atc')
-rw-r--r--games/atc/log.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/games/atc/log.c b/games/atc/log.c
index 1ca21606f54..97121c6700a 100644
--- a/games/atc/log.c
+++ b/games/atc/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.7 2001/02/04 02:15:28 pjanzen Exp $ */
+/* $OpenBSD: log.c,v 1.8 2001/02/04 13:06:20 pjanzen Exp $ */
/* $NetBSD: log.c,v 1.3 1995/03/21 15:04:21 cgd Exp $ */
/*-
@@ -50,7 +50,7 @@
#if 0
static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: log.c,v 1.7 2001/02/04 02:15:28 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: log.c,v 1.8 2001/02/04 13:06:20 pjanzen Exp $";
#endif
#endif not lint
@@ -135,6 +135,7 @@ log_score(list_em)
int i, num_scores = 0, good, changed = 0, found = 0;
struct passwd *pw;
char *cp;
+ char scanstr[50];
SCORE score[NUM_SCORES], thisscore;
if (score_fp == NULL)
@@ -149,8 +150,9 @@ log_score(list_em)
perror("flock");
return (-1);
}
+ snprintf(scanstr, 50, "%%%ds %%256s %%d %%d %%d", MAXLOGNAME);
for (;;) {
- good = fscanf(score_fp, "%s %s %d %d %d",
+ good = fscanf(score_fp, scanstr,
score[num_scores].name,
score[num_scores].game,
&score[num_scores].planes,