From 9a33f5bfb221170e823efd3c33ab5d331baf7c74 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 7 Jun 2009 20:13:18 +0000 Subject: sprintf -> snprintf, plus some use of strlcpy/strlcat where appropriate XXX: there's still one sprintf left which will take some hacking to expunge. --- hack/hack.invent.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'hack/hack.invent.c') diff --git a/hack/hack.invent.c b/hack/hack.invent.c index 6bb41c0f..8b1e7cc8 100644 --- a/hack/hack.invent.c +++ b/hack/hack.invent.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.invent.c,v 1.11 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.invent.c,v 1.12 2009/06/07 20:13:18 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.invent.c,v 1.11 2009/06/07 18:30:39 dholland Exp $"); +__RCSID("$NetBSD: hack.invent.c,v 1.12 2009/06/07 20:13:18 dholland Exp $"); #endif /* not lint */ #include @@ -703,7 +703,7 @@ xprname(struct obj *obj, char let) { static char li[BUFSZ]; - (void) sprintf(li, "%c - %s.", + (void) snprintf(li, sizeof(li), "%c - %s.", flags.invlet_constant ? obj->invlet : let, doname(obj)); return (li); @@ -866,7 +866,7 @@ dolook(void) if (gold) { char gbuf[30]; - (void) sprintf(gbuf, "%ld gold piece%s", + (void) snprintf(gbuf, sizeof(gbuf), "%ld gold piece%s", gold->amount, plur(gold->amount)); if (!ct++) pline("You %s here %s.", verb, gbuf); -- cgit v1.2.3