summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-12-07 13:47:05 -0700
committerKarl Williamson <khw@cpan.org>2019-12-18 09:33:09 -0700
commit4aada8b9eda25f3f024283c0c27c1424b5ba40ff (patch)
tree2c0ded2d593e998be054336ebf9648e4e18877fb /numeric.c
parentfcafb10c71dbfc03eacb02eeb0c567facc269a72 (diff)
downloadperl-4aada8b9eda25f3f024283c0c27c1424b5ba40ff.tar.gz
Add memCHRs() macro and use it
This replaces strchr("list", c) calls throughout the core. They don't work properly when 'c' is a NUL, returning the position of the terminating NUL in "list" instead of failure. This could lead to segfaults or even security issues.
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 0b8677d064..23cc10450b 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1150,7 +1150,7 @@ Perl_grok_number_flags(pTHX_ const char *pv, STRLEN len, UV *valuep, U32 flags)
return IS_NUMBER_IN_UV;
}
/* We could be e.g. at "Inf" or "NaN", or at the "#" of "1.#INF". */
- if ((s + 2 < send) && strchr("inqs#", toFOLD(*s))) {
+ if ((s + 2 < send) && memCHRs("inqs#", toFOLD(*s))) {
/* Really detect inf/nan. Start at d, not s, since the above
* code might have already consumed the "1." or "1". */
const int infnan = Perl_grok_infnan(aTHX_ &d, send);