Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index




On Nov 12, 2010, at 7:16, Norbert Thiebaud <nthiebaud@gmail.com> wrote:



On Nov 12, 2010, at 3:44, Julien <jnabet2412@free.fr> wrote:

Hello,

I'm currently running the last version of cppcheck (i updated with git this morning) and i get 
this error :
snprintf size is out of bounds

ex:
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:542]: (error) snprintf size is out of bounds
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:552]: (error) snprintf size is out of bounds
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:562]: (error) snprintf size is out of bounds
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:590]: (error) snprintf size is out of bounds
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:596]: (error) snprintf size is out of bounds
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:607]: (error) snprintf size is out of bounds
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:653]: (error) snprintf size is out of bounds
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:661]: (error) snprintf size is out of bounds
[./libs-gui/vcl/unx/source/printergfx/common_gfx.cxx:671]: (error) snprintf size is out of bounds

If i take the first line and i open the file, i see this :
void
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());

I don't understand where's the pb with snprintf, pString has a size of 1024 and snprintf takes a 
size of 1024.

pString has a size of 1025.
Never mind, too early in the morning, not thinking straight



Is this a false positive to give to the cppcheck guys ?

Julien.

PS : is there a pb with my patch "[Libreoffice] [PATCH] RTL_CONSTASCII_USTRINGPARAM for 
calc_unoobj" ? if it's the case, don't hesitate to tell me, i'll correct it.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.