Warning C6063

Missing string argument to 'function' that corresponds to conversion specifier 'number'.

Remarks

This warning indicates that not enough arguments are being provided to match a format string. At least one of the missing arguments is a string. This defect can cause crashes and buffer overflows (if the called function is of the sprintf family), and also potentially incorrect output.

Code analysis name: MISSING_STRING_ARGUMENT_TO_FORMAT_FUNCTION

Example

The following code generates this warning:

#include <stdio.h>
void f( )
{
  char buff[15];
  sprintf(buff, "%s %s", "Hello, World!");
}

To correct this warning, remove the unused format specifier or provide the required arguments as shown in the following code:

#include <stdio.h>
void f( )
{
  char buff[15];
  sprintf(buff, "%s %s ", "Hello","World");
}

The following code corrects this warning using safe string manipulation function:

#include <stdio.h>
void f( )
{
  char buff[15];
  sprintf_s( buff, sizeof(buff),"%s", "Hello, World!" );
}

See also

Format specification syntax: printf and wprintf functions
sprintf_s, _sprintf_s_l, swprintf_s, _swprintf_s_l