Module Name:src
Committed By: snj
Date: Mon Jun 29 23:53:01 UTC 2009
Modified Files:
src/games/hack [netbsd-4]: extern.h hack.do_name.c hack.eat.c
hack.end.c hack.fight.c hack.invent.c hack.main.c hack.objnam.c
hack.options.c hack.pri.c hack.rip.c hack.shk.c hack.topl.c
hack.unix.c
Log Message:
Pull up following revision(s) (requested by dholland in ticket #1331):
games/hack/extern.h: revision 1.11
games/hack/hack.do_name.c: revision 1.9
games/hack/hack.eat.c: revision 1.8
games/hack/hack.end.c: revision 1.12 via patch
games/hack/hack.fight.c: revision 1.10 via patch
games/hack/hack.invent.c: revision 1.12
games/hack/hack.main.c: revision 1.12
games/hack/hack.objnam.c: revision 1.9
games/hack/hack.options.c: revision 1.9
games/hack/hack.pri.c: revision 1.11
games/hack/hack.rip.c: revision 1.10
games/hack/hack.shk.c: revision 1.10
games/hack/hack.topl.c: revision 1.10
games/hack/hack.unix.c: revision 1.12
sprintf -> snprintf, plus some use of strlcpy/strlcat where appropriate
XXX: there's still one sprintf left which will take some hacking to expunge.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.16.1 src/games/hack/extern.h \
src/games/hack/hack.do_name.c src/games/hack/hack.eat.c \
src/games/hack/hack.objnam.c
cvs rdiff -u -r1.7 -r1.7.4.1 src/games/hack/hack.end.c \
src/games/hack/hack.fight.c
cvs rdiff -u -r1.10 -r1.10.4.1 src/games/hack/hack.invent.c
cvs rdiff -u -r1.9 -r1.9.16.1 src/games/hack/hack.main.c \
src/games/hack/hack.unix.c
cvs rdiff -u -r1.7 -r1.7.16.1 src/games/hack/hack.options.c \
src/games/hack/hack.rip.c src/games/hack/hack.topl.c
cvs rdiff -u -r1.8 -r1.8.16.1 src/games/hack/hack.pri.c
cvs rdiff -u -r1.8 -r1.8.4.1 src/games/hack/hack.shk.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/games/hack/extern.h
diff -u src/games/hack/extern.h:1.6 src/games/hack/extern.h:1.6.16.1
--- src/games/hack/extern.h:1.6 Tue Jan 27 20:30:29 2004
+++ src/games/hack/extern.h Mon Jun 29 23:53:01 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.6 2004/01/27 20:30:29 jsm Exp $ */
+/* $NetBSD: extern.h,v 1.6.16.1 2009/06/29 23:53:01 snj Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -363,7 +363,7 @@
char *typename(int);
char *xname(struct obj *);
char *doname(struct obj *);
-void setan(const char *, char *);
+void setan(const char *, char *, size_t);
char *aobjnam(struct obj *, const char *);
char *Doname(struct obj *);
struct obj *readobjnam(char *);
Index: src/games/hack/hack.do_name.c
diff -u src/games/hack/hack.do_name.c:1.6 src/games/hack/hack.do_name.c:1.6.16.1
--- src/games/hack/hack.do_name.c:1.6 Wed Apr 2 18:36:36 2003
+++ src/games/hack/hack.do_name.c Mon Jun 29 23:53:01 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hack.do_name.c,v 1.6 2003/04/02 18:36:36 jsm Exp $ */
+/* $NetBSD: hack.do_name.c,v 1.6.16.1 2009/06/29 23:53:01 snj Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,7 +63,7 @@
#include
#ifndef lint
-__RCSID("$NetBSD: hack.do_name.c,v 1.6 2003/04/02 18:36:36 jsm Exp $");
+__RCSID("$NetBSD: hack.do_name.c,v 1.6.16.1 2009/06/29 23:53:01 snj Exp $");
#endif/* not lint */
#include
@@ -273,7 +273,7 @@
{
static char buf[BUFSZ]; /* %% */
if (mtmp->mnamelth && !vb) {
- (void) strcpy(buf, NAME(mtmp));
+ (void) strlcpy(buf, NAME(mtmp), sizeof(buf));
return (buf);
}
switch (mtmp->data->mlet) {
@@ -286,23 +286,23 @@
(void)
strcpy((char *) mtmp->mextra, !rn2(5) ? plname : gn);
}
- (void) sprintf(buf, "%s's ghost", gn);
+ (void) snprintf(buf, sizeof(buf), "%s's ghost", gn);
}
break;
case '@':
if (mtmp->isshk) {
- (void) strcpy(buf, shkname(mtmp));
+ (void) strlcpy(buf, shkname(mtmp), sizeof(buf));
break;
}
/* fall into next case */
default:
- (void) sprintf(buf, "the %s%s",
+ (void) snprintf(buf, sizeof(buf), "the %s%s",
mtmp->minvis ? "invisible " : "",
mtmp->data->mname);
}
if (vb && mtmp->mnamelth) {
- (void) strcat(buf, " called ");
- (void) strcat(buf, NAME(mtmp));
+ (void) strlcat(buf, " called ", sizeof(buf));
+ (void) strlcat(buf, NAME(mtmp), sizeof(buf));
}
return (buf);
}
@@ -341,7 +341,7 @@
if (!strncmp(bp, "the ", 4))
bp += 4;
- (void) sprintf(buf, "the %s %s", adj, bp);
+ (void) snprintf(buf, sizeof(buf), "the %s %s", adj, bp);
return (buf);
}
Index: src/games/hack/hack.eat.c
diff -u src/games/hack/hack.eat.c:1.6 src/games/hack/hack.eat.c:1.6.16.1
--- src/games/hack/hack.eat.c:1.6 Wed Apr 2 18:36:36 2003
+++ src/games/hack/hack.eat.c Mon Jun 29 23:53:01 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hack.eat.c,v 1.6 2003/04/02 18:36:36 jsm Exp $ */
+/* $NetBSD: hack.eat.c,v 1.6.16.1 2009/06/29 23:53:01 snj Exp $ */