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.rip.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'hack/hack.rip.c') diff --git a/hack/hack.rip.c b/hack/hack.rip.c index 575aa02d..a27735ee 100644 --- a/hack/hack.rip.c +++ b/hack/hack.rip.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.rip.c,v 1.9 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.rip.c,v 1.10 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.rip.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); +__RCSID("$NetBSD: hack.rip.c,v 1.10 2009/06/07 20:13:18 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -94,9 +94,9 @@ outrip(void) (void) strcpy(buf, plname); buf[16] = 0; center(6, buf); - (void) sprintf(buf, "%ld AU", u.ugold); + (void) snprintf(buf, sizeof(buf), "%ld AU", u.ugold); center(7, buf); - (void) sprintf(buf, "killed by%s", + (void) snprintf(buf, sizeof(buf), "killed by%s", !strncmp(killer, "the ", 4) ? "" : !strcmp(killer, "starvation") ? "" : strchr(vowels, *killer) ? " an" : " a"); @@ -118,7 +118,7 @@ outrip(void) center(9, buf); center(10, buf + i1); } - (void) sprintf(buf, "%4d", getyear()); + (void) snprintf(buf, sizeof(buf), "%4d", getyear()); center(11, buf); puts(ripbot); getret(); -- cgit v1.2.3-56-ge451