perl/perl-5.31.0-perl-134169-mg.c-reset-endptr-after-use.patch
2019-06-25 17:24:26 +02:00

41 lines
1.2 KiB
Diff

From 79e302e6c3f815bf4cb72a5bacc3012595970db9 Mon Sep 17 00:00:00 2001
From: Manuel Mausz <manuel@mausz.at>
Date: Tue, 4 Jun 2019 00:29:09 +0200
Subject: [PATCH] (perl #134169) mg.c reset endptr after use
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Perl_grok_atoUV has been changed so endptr constraints the input. Thus we need to reset the endptr after every use.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
mg.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mg.c b/mg.c
index 26211dd4d0..f235f0ee5a 100644
--- a/mg.c
+++ b/mg.c
@@ -3178,7 +3178,8 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
{
const char *p = SvPV_const(sv, len);
Groups_t *gary = NULL;
- const char* endptr = p + len;
+ const char* p_end = p + len;
+ const char* endptr = p_end;
UV uv;
#ifdef _SC_NGROUPS_MAX
int maxgrp = sysconf(_SC_NGROUPS_MAX);
@@ -3201,6 +3202,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
if (endptr == NULL)
break;
p = endptr;
+ endptr = p_end;
while (isSPACE(*p))
++p;
if (!*p)
--
2.20.1