Wed Nov 30 15:37:46 2016: Request 119080 was acted upon.
Transaction: Ticket created by [email protected]
Queue: Win32-API
Subject: Win32::API::Call: parameter X had a buffer overflow with UTF-8
strings
Broken in: (no value)
Severity: (no value)
Owner: Nobody
Requestors: [email protected]
Status: new
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=119080 >
Hello,
use strict;
use Win32::API;
use Encode;
my $data = Encode::decode('UTF-8',"The price is \xe2\x82\xac5.");
my $WriteFile = Win32::API->new('kernel32.dll', 'WriteFile', 'IPIPI', 'i')
or die "Unable to load WriteFile: $!";
my $written = " " x 4;
$WriteFile->Call(0, $data, 4, $written, 0);
This fails with:
Win32::API::Call: parameter 2 had a buffer overflow
Tested on ActiveState Perl v. 5.22.1 and 5.18.2, Win::API versions 0.84,
0.82 and 0.75. Same problem happened on all of them.
--
Mikko Noromaa ([email protected]) - tel. +358 40 7348034