From ab27b02700afc3d67de0f0299ed9fd52153aae00 Mon Sep 17 00:00:00 2001 From: mrg Date: Mon, 21 Apr 1997 11:11:47 +0000 Subject: be safe with buffers. --- dm/dm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'dm') diff --git a/dm/dm.c b/dm/dm.c index fca2fd39..c994618a 100644 --- a/dm/dm.c +++ b/dm/dm.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm.c,v 1.5 1996/02/06 22:47:20 jtc Exp $ */ +/* $NetBSD: dm.c,v 1.6 1997/04/21 11:11:47 mrg Exp $ */ /* * Copyright (c) 1987, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: dm.c,v 1.5 1996/02/06 22:47:20 jtc Exp $"; +static char rcsid[] = "$NetBSD: dm.c,v 1.6 1997/04/21 11:11:47 mrg Exp $"; #endif #endif /* not lint */ @@ -101,8 +101,10 @@ play(args) { char pbuf[MAXPATHLEN]; - (void)strcpy(pbuf, _PATH_HIDE); - (void)strcpy(pbuf + sizeof(_PATH_HIDE) - 1, game); + (void)strncpy(pbuf, _PATH_HIDE, sizeof(pbuf) - 1); + (void)strncpy(pbuf + sizeof(_PATH_HIDE) - 1, game, + sizeof(pbuf) - sizeof(_PATH_HIDE) - 1); + pbuf[sizeof(pbuf) - 1] = '\0'; if (priority > 0) /* < 0 requires root */ (void)setpriority(PRIO_PROCESS, 0, priority); setgid(getgid()); /* we run setgid kmem; lose it */ -- cgit v1.2.3-56-ge451