Change 13681 by jhi@alpha on 2001/12/14 04:07:08
Buffer overflow checks.
Affected files ...
.... //depot/perl/utf8.c#127 edit
Differences ...
==== //depot/perl/utf8.c#127 (text) ====
Index: perl/utf8.c
--- perl/utf8.c.~1~ Thu Dec 13 21:15:05 2001
+++ perl/utf8.c Thu Dec 13 21:15:05 2001
@@ -927,7 +927,7 @@
UV
Perl_to_uni_lower(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN+1];
+ U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
uvchr_to_utf8(tmpbuf, (UV)c);
return to_utf8_lower(tmpbuf, p, lenp);
}
@@ -935,7 +935,7 @@
UV
Perl_to_uni_fold(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN+1];
+ U8 tmpbuf[UTF8_MAXLEN_FOLD+1];
uvchr_to_utf8(tmpbuf, (UV)c);
return to_utf8_fold(tmpbuf, p, lenp);
}
@@ -1247,7 +1247,8 @@
return 0;
}
}
- *lenp = UNISKIP(uv);
+ if *lenp)
+ *lenp = UNISKIP(uv);
uvuni_to_utf8(ustrp, uv);
return uv;
}
End of Patch.