From c9eae24eceba05cbd55018c71ec59d0df9c081f8 Mon Sep 17 00:00:00 2001
From: "Todd C. Miller" <millert@cvs.openbsd.org>
Date: Mon, 7 Apr 2003 18:19:38 +0000
Subject: Change wd1 and wd2 from pointers to arrays.  This removes the need
 for getin() to have static buffers and allows us to do "sizeof wd1".

Also fix saved game path.  It was removing the first 2 chars of
the filename due to a bug.

tdeval@ OK
---
 games/adventure/subr.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'games/adventure/subr.c')

diff --git a/games/adventure/subr.c b/games/adventure/subr.c
index 921a63c9185..3d7d44969ab 100644
--- a/games/adventure/subr.c
+++ b/games/adventure/subr.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: subr.c,v 1.5 2003/04/06 18:50:33 deraadt Exp $	*/
+/*	$OpenBSD: subr.c,v 1.6 2003/04/07 18:19:37 millert Exp $	*/
 /*	$NetBSD: subr.c,v 1.2 1995/03/21 12:05:11 cgd Exp $	*/
 
 /*-
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)subr.c	8.1 (Berkeley) 5/31/93";
 #else
-static char rcsid[] = "$OpenBSD: subr.c,v 1.5 2003/04/06 18:50:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: subr.c,v 1.6 2003/04/07 18:19:37 millert Exp $";
 #endif
 #endif /* not lint */
 
@@ -555,11 +555,11 @@ trsay()				/* 9030			*/
 {
 	int i;
 
-	if (*wd2 != 0)
-		strcpy(wd1, wd2);
+	if (wd2[0] != 0)
+		strlcpy(wd1, wd2, sizeof(wd1));
 	i = vocab(wd1, -1, 0);
 	if (i == 62 || i == 65 || i == 71 || i == 2025) {
-		*wd2 = 0;
+		wd2[0] = 0;
 		obj = 0;
 		return (2630);
 	}
@@ -833,7 +833,7 @@ trkill()				/* 9120				*/
 	rspeak(49);
 	verb = 0;
 	obj = 0;
-	getin(&wd1, &wd2);
+	getin(wd1, sizeof(wd1), wd2, sizeof(wd2));
 	if (!weq(wd1, "y") && !weq(wd1, "yes"))
 		return (2608);
 	pspeak(dragon, 1);
-- 
cgit v1.2.3