diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-24 21:37:26 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-05-24 21:37:26 +0100 |
commit | bbae360abd6ec863e8a99ca4ab058873737dbf45 (patch) | |
tree | 2db48f5e97fb63616b948b786cc8690692e4b2b8 | |
parent | ceb12f1f0217ba8594a71e20be18f84b4356adba (diff) | |
download | perl-bbae360abd6ec863e8a99ca4ab058873737dbf45.tar.gz |
In Perl_pv_escape(), avoid reading 1 byte beyond the end of the buffer.
The check for whether to use 3 digits of octal was not correct, and was capable
of reading the byte beyond the passed in buffer. Except for the small
possibility that that byte was not mapped memory, it wouldn't change the
semantic correctness of the escaped output, but it would lead to
non-deterministic choice of which format to use.
-rw-r--r-- | dump.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -321,7 +321,7 @@ Perl_pv_escape( pTHX_ SV *dsv, char const * const str, chsize = 1; break; default: - if ( (pv < end) && isDIGIT((U8)*(pv+readsize)) ) + if ( (pv+readsize < end) && isDIGIT((U8)*(pv+readsize)) ) chsize = my_snprintf( octbuf, PV_ESCAPE_OCTBUFSIZE, "%c%03o", esc, c); else |