diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-03 20:57:19 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-03 20:57:19 +0000 |
commit | ad391ad9bbfeaf73d3944b50240313a5677bcc60 (patch) | |
tree | 270b2e4acd993a5e6c9721113cd4130e6ca64f4e /pp.c | |
parent | 801ca9cd5af7c86da741a601b4721bff3f94f9cd (diff) | |
download | perl-ad391ad9bbfeaf73d3944b50240313a5677bcc60.tar.gz |
Make uv_to_utf8() to zero-terminate its output buffer,
always use (at least) UTF8_MAXLEN + 1 U8s deep buffer.
p4raw-id: //depot/perl@7967
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -2321,7 +2321,7 @@ PP(pp_ucfirst) if (DO_UTF8(sv) && (s = (U8*)SvPV(sv, slen)) && slen && (*s & 0xc0) == 0xc0) { STRLEN ulen; - U8 tmpbuf[UTF8_MAXLEN]; + U8 tmpbuf[UTF8_MAXLEN+1]; U8 *tend; UV uv = utf8_to_uv(s, slen, &ulen, 0); @@ -2380,7 +2380,7 @@ PP(pp_lcfirst) if (DO_UTF8(sv) && (s = (U8*)SvPV(sv, slen)) && slen && (*s & 0xc0) == 0xc0) { STRLEN ulen; - U8 tmpbuf[UTF8_MAXLEN]; + U8 tmpbuf[UTF8_MAXLEN+1]; U8 *tend; UV uv = utf8_to_uv(s, slen, &ulen, 0); @@ -4727,7 +4727,7 @@ PP(pp_pack) while (len-- > 0) { fromstr = NEXTFROM; auint = SvUV(fromstr); - SvGROW(cat, SvCUR(cat) + UTF8_MAXLEN); + SvGROW(cat, SvCUR(cat) + UTF8_MAXLEN + 1); SvCUR_set(cat, (char*)uv_to_utf8((U8*)SvEND(cat),auint) - SvPVX(cat)); } |