diff options
author | Karl Williamson <khw@cpan.org> | 2017-03-25 14:50:48 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2017-11-06 14:31:45 -0700 |
commit | 5716a028c7461672700c451fd2f25daa794a88bd (patch) | |
tree | 1098545393a4e72ec2678268c10d8ecb77f45aed /pp_sys.c | |
parent | 320d4f1b610f3c392d21c3f0af229c6d31adc84a (diff) | |
download | perl-5716a028c7461672700c451fd2f25daa794a88bd.tar.gz |
pp_sys.c; Use memchr instead of strchr
This allows things to work properly in the face of embedded NULs.
See the branch merge message for more information.
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1509,10 +1509,11 @@ PP(pp_leavewrite) if (IoFLAGS(io) & IOf_DIDTOP) { /* Oh dear. It still doesn't fit. */ I32 lines = IoLINES_LEFT(io); const char *s = SvPVX_const(PL_formtarget); + const char *e = SvEND(PL_formtarget); if (lines <= 0) /* Yow, header didn't even fit!!! */ goto forget_top; while (lines-- > 0) { - s = strchr(s, '\n'); + s = (char *) memchr(s, '\n', e - s); if (!s) break; s++; |