[X2Go-Dev] Bug#777: nx-libs: incorrect usage of scanf

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Jan 30 20:35:53 CET 2015


package: nx-libs
version: head

In different parts of the nx-libs library you can find usages of scanf like

   /* check for MESA_GAMMA environment variable */
   gamma = _mesa_getenv("MESA_GAMMA");
   if (gamma) {
      v->RedGamma = v->GreenGamma = v->BlueGamma = 0.0;
      sscanf( gamma, "%f %f %f", &v->RedGamma, &v->GreenGamma,
&v->BlueGamma );

According to cppcheck:

scanf without field width limits can crash with huge input data on libc
versions older than 2.13-25. Add a field width specifier to fix this
problem:
    %i => %3i


Best regards

Heinrich Schuchardt


More information about the x2go-dev mailing list