Date: Thu, 4 Jan 2001 14:23:31 -0500 From: Chris Faulhaber <jedgar@fxp.org> To: Will Andrews <will@FreeBSD.org> 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> In-Reply-To: <200101041905.f04J5ou82617@freefall.freebsd.org>; from will@FreeBSD.org on Thu, Jan 04, 2001 at 11:05:49AM -0800 References: <200101041905.f04J5ou82617@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010104142331.D47414>