diff options
author | mrg <mrg@NetBSD.org> | 1997-04-21 11:11:47 +0000 |
---|---|---|
committer | mrg <mrg@NetBSD.org> | 1997-04-21 11:11:47 +0000 |
commit | ab27b02700afc3d67de0f0299ed9fd52153aae00 (patch) | |
tree | 2a18b882619188648ea31fea3db7e95754458175 /dm/dm.c | |
parent | 31dcfed54fa251e59812658e5eff841533959983 (diff) | |
download | bsdgames-darwin-ab27b02700afc3d67de0f0299ed9fd52153aae00.tar.gz bsdgames-darwin-ab27b02700afc3d67de0f0299ed9fd52153aae00.tar.zst bsdgames-darwin-ab27b02700afc3d67de0f0299ed9fd52153aae00.zip |
be safe with buffers.
Diffstat (limited to 'dm/dm.c')
-rw-r--r-- | dm/dm.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 */ |