summaryrefslogtreecommitdiff
path: root/pp_hot.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 /pp_hot.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 'pp_hot.c')
-rw-r--r--pp_hot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 2df5df8303..b95ac50d9d 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3269,9 +3269,9 @@ Perl_do_readline(pTHX)
}
for (t1 = SvPVX_const(sv); *t1; t1++)
#ifdef __VMS
- if (strchr("*%?", *t1))
+ if (memCHRs("*%?", *t1))
#else
- if (strchr("$&*(){}[]'\";\\|?<>~`", *t1))
+ if (memCHRs("$&*(){}[]'\";\\|?<>~`", *t1))
#endif
break;
if (*t1 && PerlLIO_lstat(SvPVX_const(sv), &statbuf) < 0) {