summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2019-08-20 13:03:58 +0100
committerDavid Mitchell <davem@iabyn.com>2019-08-20 13:47:16 +0100
commit3df4a9e6a0858b2eb211254bf6f09de3e233a172 (patch)
treeeac91ac05fc834baa71c51a5fdfe378e05dd00f8 /util.c
parent285db6955f5604d4f99b127b881cc95bb1ef131d (diff)
downloadperl-3df4a9e6a0858b2eb211254bf6f09de3e233a172.tar.gz
Perl_quadmath_format_single(): fix off-by-1 err
RT #134369 This function checks that a floating format string (%f, %e etc) on -Dusequadmath builds has the 'Q' qualifier , and if not adds it. However, the "adding" code allocates a new buffer that is one byte too short, which this commit fixes. In practice it doesn't matter, as in core, this function is only ever called when the 'Q' is already present.
Diffstat (limited to 'util.c')
-rw-r--r--util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util.c b/util.c
index 165d13a39e..359f3b6d85 100644
--- a/util.c
+++ b/util.c
@@ -4931,7 +4931,7 @@ Perl_quadmath_format_single(const char* format)
return NULL;
if (format[len - 2] != 'Q') {
char* fixed;
- Newx(fixed, len + 1, char);
+ Newx(fixed, len + 2, char);
memcpy(fixed, format, len - 1);
fixed[len - 1] = 'Q';
fixed[len ] = format[len - 1];