From: Ian Phillipps Date: Thu, 22 Jul 1999 22:48:59 +0000 (+0100) Subject: make reset() behave with high-bit characters X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4802d5d799ab971f97d7df94b7f1637c213350a8;p=p5sagit%2Fp5-mst-13.2.git make reset() behave with high-bit characters Message-ID: <19990722224859.A27987@homer.diplex.co.uk> Subject: [PATCH 5.005_57] sv_reset can cause stack corruption p4raw-id: //depot/perl@3758 --- diff --git a/sv.c b/sv.c index 0c48260..4bdf847 100644 --- a/sv.c +++ b/sv.c @@ -4014,7 +4014,7 @@ Perl_sv_reset(pTHX_ register char *s, HV *stash) register I32 i; register PMOP *pm; register I32 max; - char todo[256]; + char todo[PERL_UCHAR_MAX+1]; if (!stash) return; @@ -4033,11 +4033,11 @@ Perl_sv_reset(pTHX_ register char *s, HV *stash) Zero(todo, 256, char); while (*s) { - i = *s; + i = (unsigned char)*s; if (s[1] == '-') { s += 2; } - max = *s++; + max = (unsigned char)*s++; for ( ; i <= max; i++) { todo[i] = 1; }