[Libreoffice] Fwd: Re: cppcheck : snprintf size is out of bounds
julien
serval2412 at yahoo.fr
Wed Nov 17 12:50:38 PST 2010
Le 17/11/2010 17:08, Caolán McNamara a écrit :
> On Fri, 2010-11-12 at 12:44 +0100, Julien wrote:
>
>> Hello,
>>
>> I'm currently running the last version of cppcheck (i updated with git
>> this morning) and i get this error :
>> I don't understand where's the pb with snprintf, pString has a size of
>> 1024 and snprintf takes a size of 1024.
>>
>> Is this a false positive to give to the cppcheck guys ?
>>
> Well I think so. if you replace nBezString in the sprintf line with a
> raw 1024 does it complain ?
>
> C.
>
>
After several tests, i noticed for these lines in
libs-gui/vcl/unx/source/printergfx/common_gfx.cxx (from line 530):
PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath,
const BYTE* pFlgAry)
{
const sal_uInt32 nBezString = 1024;
sal_Char pString[nBezString];
if ( nPoints> 1&& maLineColor.Is()&& pPath )
{
PSSetColor (maLineColor);
PSSetColor ();
PSSetLineWidth ();
snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(),
pPath[0].Y());
There's no more cppcheck errors if if i change the line :
const sal_uInt32 nBezString = 1024;
into this :
sal_uInt32 nBezString = 1024;
Before i create a tracker for cppcheck guy, i'd like to know what you
think about it ?
Julien.
More information about the LibreOffice
mailing list