From owner-cvs-all Thu Jan 4 11:23:38 2001 From owner-cvs-all@FreeBSD.ORG Thu Jan 4 11:23:33 2001 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from peitho.fxp.org (peitho.fxp.org [209.26.95.40]) by hub.freebsd.org (Postfix) with ESMTP id C3B0937B400; Thu, 4 Jan 2001 11:23:32 -0800 (PST) Received: by peitho.fxp.org (Postfix, from userid 1501) id B4B6913612; Thu, 4 Jan 2001 14:23:31 -0500 (EST) Date: Thu, 4 Jan 2001 14:23:31 -0500 From: Chris Faulhaber To: Will Andrews Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/apply apply.c Message-ID: <20010104142331.D47414@peitho.fxp.org> References: <200101041905.f04J5ou82617@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200101041905.f04J5ou82617@freefall.freebsd.org>; from will@FreeBSD.org on Thu, Jan 04, 2001 at 11:05:49AM -0800 Sender: cdf.lists@fxp.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Jan 04, 2001 at 11:05:49AM -0800, Will Andrews wrote: > will 2001/01/04 11:05:49 PST > > Modified files: > usr.bin/apply apply.c > Log: > BDECFLAGS; de-__P()-ify, ANSIfy, use snprintf() instead of sprintf(), > especially on strings passed from argv; rename system() to exec_shell(), > and make it static; use strlcpy() and make sure it works; use proper > type (size_t) to be passed to malloc()/realloc(). > All the snprintf/strlcpy 'fixes' you made are quite broken since the variables you apply sizeof() to are pointers: char *c, *cmd, *p, *q; ... - 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); -- Chris D. Faulhaber - jedgar@fxp.org - jedgar@FreeBSD.org -------------------------------------------------------- FreeBSD: The Power To Serve - http://www.FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message