summaryrefslogtreecommitdiffstats
path: root/hack/hack.do_name.c
diff options
context:
space:
mode:
Diffstat (limited to 'hack/hack.do_name.c')
-rw-r--r--hack/hack.do_name.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hack/hack.do_name.c b/hack/hack.do_name.c
index e29e4d20..21ee4275 100644
--- a/hack/hack.do_name.c
+++ b/hack/hack.do_name.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hack.do_name.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */
+/* $NetBSD: hack.do_name.c,v 1.9 2009/06/07 20:13:18 dholland Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,7 +63,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hack.do_name.c,v 1.8 2009/06/07 18:30:39 dholland Exp $");
+__RCSID("$NetBSD: hack.do_name.c,v 1.9 2009/06/07 20:13:18 dholland Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -268,7 +268,7 @@ xmonnam(struct monst *mtmp, int vb)
{
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) {
@@ -281,23 +281,23 @@ xmonnam(struct monst *mtmp, int vb)
(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);
}
@@ -331,7 +331,7 @@ amonnam(struct monst *mtmp, const char *adj)
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);
}