atom feed12 messages in org.freebsd.freebsd-auditRe: WFORMAT=1 errors
FromSent OnAttachments
Kris KennawayAug 10, 2001 6:21 pm 
Seth KingsleyAug 10, 2001 7:41 pm 
Kris KennawayAug 10, 2001 8:19 pm 
Seth KingsleyAug 13, 2001 5:39 pm 
Kris KennawayAug 14, 2001 2:40 am 
Seth KingsleyAug 14, 2001 2:06 pm 
Mike BarcroftAug 14, 2001 3:36 pm 
Bruce EvansAug 14, 2001 6:47 pm 
Seth KingsleyAug 14, 2001 7:56 pm 
Kris KennawayAug 14, 2001 8:25 pm 
Kris KennawayAug 14, 2001 8:28 pm 
Bruce EvansAug 14, 2001 9:01 pm 
Subject:Re: WFORMAT=1 errors
From:Bruce Evans (bd@zeta.org.au)
Date:Aug 14, 2001 9:01:27 pm
List:org.freebsd.freebsd-audit

On Tue, 14 Aug 2001, Seth Kingsley wrote:

On Wed, Aug 15, 2001 at 11:47:55AM +1000, Bruce Evans wrote:

On Tue, 14 Aug 2001, Seth Kingsley wrote:

struct shell_desc { const char *echo_fmt; };

static struct shell_desc sh_desc = {"echo \"%s\""};

sprintf(cmd, sh_desc, echo_str);

Is there any way around this?

No (modulo bugs). Format strings that have been constructed at runtime (e.g., using sprintf(), or read from a message catalog) can't pass the WFORMAT=1 checks, since a different construction might give buffer overruns or arg mismatches.

Argh, but this code snippet is clearly not in violation of those rules.

But it is. shell_desc is a trivial message catalog which you happen never to change. In make/job.c, the message catalog is sometimes "read" from shells[shellnum], but it is read from makefiles for the .SHELL directive! See jobParseShell() and the make tutorial.

Bruce

To Unsubscribe: send mail to majo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message