summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-07-30 22:09:12 -0600
committerKarl Williamson <khw@cpan.org>2018-09-10 17:37:31 -0600
commitdb54010671d6c27faf667d658073743b14cd9b58 (patch)
tree20a37e67749cadfb10fc94d29ea06714e7f3f716 /utf8.c
parent295a484ee22a430520edcf29ce6d2353844fd6c4 (diff)
downloadperl-db54010671d6c27faf667d658073743b14cd9b58.tar.gz
utf8.c: Don't assume UTF-8 sequence has enough space.
Instead use the end pointer passed in.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/utf8.c b/utf8.c
index b1ac5a84a1..86586982e1 100644
--- a/utf8.c
+++ b/utf8.c
@@ -3950,7 +3950,7 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p,
/* Special case these two characters, as what normally gets
* returned under locale doesn't work */
- if (memEQs((char *) p, UTF8SKIP(p), CAP_SHARP_S))
+ if (memBEGINs((char *) p, e - p, CAP_SHARP_S))
{
/* diag_listed_as: Can't do %s("%s") on non-UTF-8 locale; resolved to "%s". */
Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE),
@@ -3960,7 +3960,7 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p,
}
else
#endif
- if (memEQs((char *) p, UTF8SKIP(p), LONG_S_T))
+ if (memBEGINs((char *) p, e - p, LONG_S_T))
{
/* diag_listed_as: Can't do %s("%s") on non-UTF-8 locale; resolved to "%s". */
Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE),
@@ -3979,7 +3979,7 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *p,
* 255/256 boundary which is forbidden under /l, and so the code
* wouldn't catch that they are equivalent (which they are only in
* this release) */
- else if (memEQs((char *) p, UTF8SKIP(p), DOTTED_I)) {
+ else if (memBEGINs((char *) p, e - p, DOTTED_I)) {
/* diag_listed_as: Can't do %s("%s") on non-UTF-8 locale; resolved to "%s". */
Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE),
"Can't do fc(\"\\x{0130}\") on non-UTF-8 locale; "