]> git.cameronkatri.com Git - bsdgames-darwin.git/commitdiff
read config more strictly, from Maximillian Dornseif
authordan <dan@NetBSD.org>
Thu, 25 May 2006 07:11:54 +0000 (07:11 +0000)
committerdan <dan@NetBSD.org>
Thu, 25 May 2006 07:11:54 +0000 (07:11 +0000)
dm/dm.c

diff --git a/dm/dm.c b/dm/dm.c
index 4dd2553abf55cb4eaddede33e3b22fe721a32659..5cae6605db71ce7aeeecb2d22567ee97bd0c4777 100644 (file)
--- a/dm/dm.c
+++ b/dm/dm.c
@@ -1,4 +1,4 @@
-/*     $NetBSD: dm.c,v 1.22 2005/07/02 08:35:29 jmc Exp $      */
+/*     $NetBSD: dm.c,v 1.23 2006/05/25 07:11:54 dan Exp $      */
 
 /*
  * Copyright (c) 1987, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
 #if 0
 static char sccsid[] = "@(#)dm.c       8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dm.c,v 1.22 2005/07/02 08:35:29 jmc Exp $");
+__RCSID("$NetBSD: dm.c,v 1.23 2006/05/25 07:11:54 dan Exp $");
 #endif
 #endif /* not lint */
 
@@ -130,19 +130,19 @@ read_config(void)
        while (fgets(lbuf, sizeof(lbuf), cfp))
                switch (*lbuf) {
                case 'b':               /* badtty */
-                       if (sscanf(lbuf, "%s%s", f1, f2) != 2 ||
+                       if (sscanf(lbuf, "%39s%39s", f1, f2) != 2 ||
                            strcasecmp(f1, "badtty"))
                                break;
                        c_tty(f2);
                        break;
                case 'g':               /* game */
-                       if (sscanf(lbuf, "%s%s%s%s%s",
+                       if (sscanf(lbuf, "%39s%39s%39s%39s%39s",
                            f1, f2, f3, f4, f5) != 5 || strcasecmp(f1, "game"))
                                break;
                        c_game(f2, f3, f4, f5);
                        break;
                case 't':               /* time */
-                       if (sscanf(lbuf, "%s%s%s%s", f1, f2, f3, f4) != 4 ||
+                       if (sscanf(lbuf, "%39s%39s%39s%39s", f1, f2, f3, f4) != 4 ||
                            strcasecmp(f1, "time"))
                                break;
                        c_day(f2, f3, f4);