cscanfpc-lint

How to fix warning - Unbound scanf conversion


I am trying to use the following in my code :

int val;
val = sscanf ( line_pointer, "%u,%u %s %s", &unit_id, &subprogram_id, flags.get(), slotDescriptionPtr.get() );

But getting this warning with PC-Lint

 warning 498: unbounded scanf conversion specifier '[' may result in buffer overflow
   sscanf( value + 7, "%[^/]/%[^/]/%[^\n]", low, high, delta );

Solution

  • How to fix warning