This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make utf8_to_uvchr() slightly safer
[perl5.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index ceb8ed8..06b7768 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -5755,8 +5755,8 @@ Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen)
     }
 
     return utf8_to_uvchr_buf(s,
-                             s + my_strnlen((char *) s, UTF8_MAXBYTES),
-                            retlen);
+                             s + my_strnlen((char *) s, UTF8SKIP(s)),
+                             retlen);
 }
 
 /*