Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/games/rogue Pull up revision 1.13 (requested by mrg in ...



details:   https://anonhg.NetBSD.org/src/rev/1791046f9762
branches:  netbsd-1-6
changeset: 529124:1791046f9762
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Oct 01 23:45:26 2002 +0000

description:
Pull up revision 1.13 (requested by mrg in ticket #892):
- use correctly bounded strings when reloading a saved game.  in particular,
do not let the save game file "string length" exceed the amount of space
supplied.  as noted by <stanojr%iserver.sk@localhost> on bugtraq.
- minor KNF.
tested by simonb.

diffstat:

 games/rogue/rogue.h |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 5a695424a2d7 -r 1791046f9762 games/rogue/rogue.h
--- a/games/rogue/rogue.h       Tue Oct 01 23:45:18 2002 +0000
+++ b/games/rogue/rogue.h       Tue Oct 01 23:45:26 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rogue.h,v 1.12 2001/02/05 01:04:25 christos Exp $      */
+/*     $NetBSD: rogue.h,v 1.12.2.1 2002/10/01 23:45:26 lukem Exp $     */
 
 /*
  * Copyright (c) 1988, 1993
@@ -192,9 +192,10 @@
 
 #define MAX_OPT_LEN 40
 
+#define MAX_ID_TITLE_LEN 64
 struct id {
        short value;
-       char *title;
+       char title[MAX_ID_TITLE_LEN];
        char *real;
        unsigned short id_status;
 };
@@ -658,7 +659,7 @@
 void   rand_place __P((object *));
 void   read_pack __P((object *, FILE *, boolean));
 void   read_scroll __P((void));
-void   read_string __P((char *, FILE *));
+void   read_string __P((char *, FILE *, size_t));
 void   recursive_deadend __P((short, const short *, short, short));
 boolean        reg_move __P((void));
 void   relight __P((void));
@@ -763,8 +764,9 @@
 extern boolean trap_door;
 extern boolean wizard;
 extern char    hit_message[];
-extern char    hunger_str[];
-extern char    login_name[];
+#define HUNGER_STR_LEN 8
+extern char    hunger_str[HUNGER_STR_LEN];
+extern char    login_name[MAX_OPT_LEN];
 extern const char   *byebye_string;
 extern const char   *curse_message;
 extern const char   *error_file;



Home | Main Index | Thread Index | Old Index