On Fri, 23 Feb 2018, Petr Pisar via Pcre-dev wrote:
> I tested it successfully on GNU/Linux on these platforms:
Thank you.
> Please note gcc-8 with glibc-2.27 emmits this warning:
>
> gcc -DHAVE_CONFIG_H -I. -pthread -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -c -o pcregrep-pcregrep.o `test -f 'pcregrep.c' || echo './'`pcregrep.c
> pcregrep.c: In function 'main':
> pcregrep.c:2767:31: warning: '__builtin___sprintf_chk' may write a terminating nul past the end of the destination [-Wformat-overflow=]
> sprintf(buff2, "%s%.*s", buff1, fulllen - baselen - 2, opbra + 1);
It turns out that gcc 7.2.1 (which I am currently on) also issues this
warning when -Wformat-overflow=2 is specified. There were two instances
in pcre2grep and three in pcregrep. I have put that warning into my
standard development setup now, and fixed both pcregrep and pcre2grep
with patches that are slightly different to yours. Thanks for the
report.
Philip
--
Philip Hazel