Subject: Re: [msysGit] [PATCH v3 02/14] mingw: implement syslog

From: Eric Sunshine <[email-masked]>
Date: Sun, 10 Oct 2010 15:50:39 -0400

On 10/10/2010 9:20 AM, Erik Faye-Lund wrote:
> From: Mike Pape<[email-masked]>
>
> Syslog does not usually exist on Windows, so we implement our own
> using Window's ReportEvent mechanism.
>
> Signed-off-by: Mike Pape<[email-masked]>
> Signed-off-by: Erik Faye-Lund<[email-masked]>
> ---
> +void syslog(int priority, const char *fmt, const char *arg)
> +{
> +	WORD logtype;
> +
> +	if (!ms_eventlog)
> +		return;
> +
> +	if (strcmp(fmt, "%s")) {
> +		warning("format string of syslog() not implemented");
> +		return;
> +	}

It is not exactly clear what the intention is here. Is this trying to 
say that no formatting directives are allowed in 'fmt' or what? The 
simple case it is actually checking (where 'fmt' is solely '%s') could 
easily be handled manually, as could more complex formats.

> +	/*
> +	 * ReportEvent() doesn't handle strings containing %n, where n is
> +	 * an integer. Such events must be reformatted by the caller.
> +	 */
> +	ReportEventA(ms_eventlog,
> +	    logtype,
> +	    0,
> +	    0,
> +	    NULL,
> +	    1,
> +	    0,
> +	    (const char **)&arg,
> +	    NULL);

The comment about '%n' seems to be warning about a potential problem but 
does not actually protect against it. Should this issue be handled?

-- ES