From owner-freebsd-audit Mon Dec 4 18:48:28 2000 From owner-freebsd-audit@FreeBSD.ORG Mon Dec 4 18:48:26 2000 Return-Path: Delivered-To: freebsd-audit@freebsd.org Received: from puck.firepipe.net (mcut-b-167.resnet.purdue.edu [128.211.209.167]) by hub.freebsd.org (Postfix) with ESMTP id 4EEDF37B400 for ; Mon, 4 Dec 2000 18:48:26 -0800 (PST) Received: by puck.firepipe.net (Postfix, from userid 1000) id BFF2B18C5; Mon, 4 Dec 2000 21:48:25 -0500 (EST) Date: Mon, 4 Dec 2000 21:48:25 -0500 From: Will Andrews To: Max Khon Cc: Will Andrews , audit@FreeBSD.ORG Subject: Re: usr.bin audit patch Message-ID: <20001204214825.Z570@puck.firepipe.net> Reply-To: Will Andrews Mail-Followup-To: Will Andrews , Max Khon , audit@FreeBSD.ORG References: <20001204201058.W570@puck.firepipe.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from fjoe@iclub.nsu.ru on Tue, Dec 05, 2000 at 08:43:26AM +0600 X-Operating-System: FreeBSD 4.1-STABLE i386 Sender: will@puck.firepipe.net Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Dec 05, 2000 at 08:43:26AM +0600, Max Khon wrote: > p = cmd; > - p += sprintf(cmd, "exec %s", argv[0]); > + p += snprintf(cmd, sizeof(cmd), "exec %s", argv[0]); > for (i = 1; i <= nargs; i++) > - p += sprintf(p, " %c%d", magic, i); > + p += snprintf(p, sizeof(p), " %c%d", magic, i); > > sizeof(p) == sizeof(void *) (== 4 on i386) -- it is not what your tried to > achieve. also do not use strncpy/strncat instead of strcpy/strcat. in most > cases this is useless -- use strlcpy/strlcat instead Ah, ok. You have a point about the latter diff, what about the former? It seems a huge hole to allow a user to specify input via command-line -- even if it's the command itself (argv[0]). -- wca To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message