This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #129149) avoid a heap buffer overflow with pack "W"...
[perl5.git] / pp_pack.c
index ee4c69e..737e019 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -2587,7 +2587,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
                if (in_bytes) auv = auv % 0x100;
                if (utf8) {
                  W_utf8:
                if (in_bytes) auv = auv % 0x100;
                if (utf8) {
                  W_utf8:
-                   if (cur > end) {
+                   if (cur >= end) {
                        *cur = '\0';
                        SvCUR_set(cat, cur - start);
 
                        *cur = '\0';
                        SvCUR_set(cat, cur - start);