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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 10, 2010 at 10:51 PM, Johannes Sixt <j6t@xxxxxxxx> wrote:
> On Sonntag, 10. Oktober 2010, Erik Faye-Lund wrote:
>> On Sun, Oct 10, 2010 at 9:50 PM, Eric Sunshine <ericsunshine@xxxxxxxxx>
> wrote:
>> > On 10/10/2010 9:20 AM, Erik Faye-Lund wrote:
>> >> +       /*
>> >> +        * ReportEvent() doesn't handle strings containing %n, where n
>> >> is +        * an integer. Such events must be reformatted by the caller.
>> >> +        */
>> >
>> > The comment about '%n' seems to be warning about a potential problem but
>> > does not actually protect against it. Should this issue be handled?
>>
>> This is again an issue that was discussed in the first round.
>> ReportEvent() CANNOT report a string containing "%n" (where n is an
>> integer). And while we could probably try to work around it by
>> inserting a space or something, and I don't think we ever were able to
>> find a case where we could report a string containing "%n" in the
>> first place...
>
> I recall that it was mentioned that this could happen for IPv6 addresses?
>

Ah, that's right. Microsoft even mentions it in MSDN: "Note that the
string that you log cannot contain %n, where n is an integer value
(for example, %1) because the event viewer treats it as an insertion
string. Because an IPv6 address can contain this character sequence,
you cannot log an event message that contains an IPv6 address".

What should we do about it? Error out?

Strangely enough, reporting strings with "%1" works fine when I test
it now. Perhaps this is dependent on the windows-version?

Yep, it is. On Vista 64 it seems to work, but on WinXP it does not.
The string gets expanded into itself 100 times, and then there's
apparently a recursion test.

Also, it is only %1 that does not report correctly on WinXP, probably
because of a check against the wNumStrings-parameter. Even strings
like %11 does not expand.

FormatMessage has the FORMAT_MESSAGE_IGNORE_INSERTS-flag to avoid this
kind of expansion, but unfortunately I can't find similar
functionality for ReportEvent :(
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]