This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_vcatpvfn_flags: fix arg to SNPRINTF_G()
authorDavid Mitchell <davem@iabyn.com>
Mon, 15 May 2017 12:54:17 +0000 (13:54 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 7 Jun 2017 08:11:01 +0000 (09:11 +0100)
One of the callers of SNPRINTF_G() passes 'size' as its third arg - but
there is no such variable. This code happens only to be used in the
!USE_QUADMATH branch, and the SNPRINTF_G macro only uses that arg under
USE_QUADMATH. So it doesn't matter. But replace 'size' with 'sizeof(ebuf)'
in case that changes in future.

sv.c

diff --git a/sv.c b/sv.c
index 38eccea..0ffd29a 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11541,7 +11541,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
                     if (digits && digits < sizeof(ebuf) - NV_DIG - 10) {
                         /* 0, point, slack */
                         STORE_LC_NUMERIC_SET_TO_NEEDED();
-                        SNPRINTF_G(nv, ebuf, size, digits);
+                        SNPRINTF_G(nv, ebuf, sizeof(ebuf), digits);
                         sv_catpv_nomg(sv, ebuf);
                         if (*ebuf)     /* May return an empty string for digits==0 */
                             return;