This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #112478] Avoid buffer overflow in upg_version
authorFather Chrysostomos <sprout@cpan.org>
Tue, 17 Apr 2012 03:24:45 +0000 (20:24 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 17 Apr 2012 03:24:45 +0000 (20:24 -0700)
commit78e230aef16bcd45dba3b038bb0883d528a495bd
tree65ca2bc430be792fa554a2d7ecabc92de9d70337
parent04bd644859054f7d9eeb94b6c7a3e2b76872a6ab
[perl #112478] Avoid buffer overflow in upg_version

On most systems, this is actually a panic, rather than an overflow,
because the overflow is detected before it can happen.

upg_version needs to use the equivalent of sprintf "%.9f" on a numeric
input before parsing it.  For speed’s sake, I assume, it was done
using my_snprintf, with a C auto for the buffer, declared with a fixed
size of 64.

There is no guarantee that the number passed in will not overflow that
buffer, so upg_version should use an SV and sv_catpvf in those cases
where it would overflow.
lib/version/t/coretests.pm
util.c