diff options
author | Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> | 2017-10-15 09:33:22 +0200 |
---|---|---|
committer | Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> | 2017-10-21 20:08:39 +0100 |
commit | 17661fb1c2bdb3f4c7af40322c5694e9651dafff (patch) | |
tree | 0f4dfd339f839cf4ce96f9c13d5b8b47a8c1c58f /sv.c | |
parent | aefb3fa072c057c13029faf2c7044bca8e0cc344 (diff) | |
download | perl-17661fb1c2bdb3f4c7af40322c5694e9651dafff.tar.gz |
Fix sv_vcatpvfn %s with precision on non-NUL-terminated strings
The precision parameter to %s can be used to print non-NUL-terminated
strings, so use my_strnlen() to limit the length checking to the
specified length.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -12376,7 +12376,10 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p if (args) { eptr = va_arg(*args, char*); if (eptr) - elen = strlen(eptr); + if (has_precis) + elen = my_strnlen(eptr, precis); + else + elen = strlen(eptr); else { eptr = (char *)nullstr; elen = sizeof nullstr - 1; |