diff options
author | Aaron Crane <arc@cpan.org> | 2016-04-14 11:23:12 +0100 |
---|---|---|
committer | Matthew Horsfall <wolfsage@gmail.com> | 2016-04-19 16:23:58 -0400 |
commit | 5068f264e5db925e43c1b4fab9c9c9a44f9a1926 (patch) | |
tree | 25ff821f44f17839e484b7901179b19026b3cb23 | |
parent | 19d6c3854e96d89bf4dc2d874df433beac27ee8b (diff) | |
download | perl-5068f264e5db925e43c1b4fab9c9c9a44f9a1926.tar.gz |
Avoid passing non-literal to format function
This avoids the following error, reported by Jitka PlesnĂková
<jplesnik@redhat.com> in a test of RC1:
op.c: In function 'Perl_ck_ftst':
op.c:9754:58: error: format not a string literal and no format arguments [-Werror=format-security]
Perl_warner(aTHX_ packWARN(WARN_SYNTAX), array_passed_to_stat);
In addition, the string in question is now made const.
-rw-r--r-- | op.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -109,7 +109,7 @@ recursive, but it's recursive on basic blocks, not on tree nodes. #define CALL_RPEEP(o) PL_rpeepp(aTHX_ o) #define CALL_OPFREEHOOK(o) if (PL_opfreehook) PL_opfreehook(aTHX_ o) -static char array_passed_to_stat[] = "Array passed to stat will be coerced to a scalar"; +static const char array_passed_to_stat[] = "Array passed to stat will be coerced to a scalar"; /* Used to avoid recursion through the op tree in scalarvoid() and op_free() @@ -9751,7 +9751,7 @@ Perl_ck_ftst(pTHX_ OP *o) } else { /* diag_listed_as: Array passed to stat will be coerced to a scalar%s */ - Perl_warner(aTHX_ packWARN(WARN_SYNTAX), array_passed_to_stat); + Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "%s", array_passed_to_stat); } } scalar((OP *) kid); |