On Mon, 31 Dec 2007, Sheri wrote:
> Well, personally I think you should do something about it. The Microsoft
> toolchain is prevalent on Windows and I don't think pcregrep should
> crash! if built there. It doesn't look like much is involved to fix it
... the posted fix calls a function which is NOT in Standard C ... Thus,
a lot *is* involved, though perhaps there is another approach that might
work. I'm sorry to be a grumpy old man, but standards are standards for
a reason, and every now and again I feel I have to kick.
> Where is Bob Rossi, couldn't he look at this? He once suggested the
> following regarding a similar issue in the cpp program (but Craig did
> something different):
>
> #if defined (_WIN32) && defined (_MSC_VER)
Indeed, it might involve something like that if a non-standard function
has to be called.
> "Because of security reasons, support for the %n format specifier is
> disabled by default in printf and all its variants. If %n is encountered
> in a printf format specification, the default behavior is to invoke the
> invalid parameter handler as described in Parameter Validation
> <http://msdn2.microsoft.com/en-us/library/ksazx244.aspx>. Calling
> _set_printf_count_output with a non-zero argument will cause
> printf-family functions to interpret %n as described in printf Type
> Field Characters <http://msdn2.microsoft.com/en-us/library/hf4y5e3w.aspx>."
Sigh. OK, thanks for the research. Since there are already
Windows-specific things in pcregrep, I guess it isn't a huge effort to
insert one conditional line of code. I'll do it next year. <grin>
Philip
--
Philip Hazel